diff --git a/.coveragerc b/.coveragerc index 0d8e6297d..6bf364f90 100644 --- a/.coveragerc +++ b/.coveragerc @@ -17,22 +17,18 @@ # Generated by synthtool. DO NOT EDIT! [run] branch = True -omit = - google/cloud/__init__.py [report] fail_under = 100 show_missing = True +omit = google/cloud/dialogflow/__init__.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore abstract methods - raise NotImplementedError -omit = - */gapic/*.py - */proto/*.py - */core/*.py - */site-packages/*.py - google/cloud/__init__.py + # Ignore pkg_resources exceptions. + # This is added at the module level as a safeguard for if someone + # generates the code and tries to run it without pip installing. This + # makes it virtually impossible to test properly. + except pkg_resources.DistributionNotFound \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 4369a419d..fe8554689 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -10,7 +10,7 @@ Thanks for stopping by to let us know something could be better! Please run down the following list and make sure you've tried the usual "quick fixes": - - Search the issues already opened: https://github.com/googleapis/dialogflow-python-client-v2/issues + - Search the issues already opened: https://github.com/googleapis/python-dialogflow/issues - Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python If you are still having issues, please be sure to include as much information as possible: @@ -20,7 +20,7 @@ If you are still having issues, please be sure to include as much information as - OS type and version: - Python version: `python --version` - pip version: `pip --version` - - `dialogflow` version: `pip show dialogflow` + - `google-cloud-dialogflow` version: `pip show google-cloud-dialogflow` #### Steps to reproduce diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7c3dd5284..e4f3b0305 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,5 @@ Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: -- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/dialogflow-python-client-v2/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea +- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-dialogflow/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 682c163b3..f97d0c63b 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -15,7 +15,7 @@ set -eo pipefail -cd github/dialogflow-python-client-v2 +cd github/python-dialogflow # Disable buffering, so that the logs stream through. export PYTHONUNBUFFERED=1 diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg index ef672c96e..76c8fc565 100644 --- a/.kokoro/continuous/common.cfg +++ b/.kokoro/continuous/common.cfg @@ -14,7 +14,7 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-python" # Use the trampoline script to run in docker. -build_file: "dialogflow-python-client-v2/.kokoro/trampoline.sh" +build_file: "python-dialogflow/.kokoro/trampoline.sh" # Configure the docker image for kokoro-trampoline. env_vars: { @@ -23,5 +23,5 @@ env_vars: { } env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/dialogflow-python-client-v2/.kokoro/build.sh" + value: "github/python-dialogflow/.kokoro/build.sh" } diff --git a/.kokoro/docs/common.cfg b/.kokoro/docs/common.cfg index 69334436e..d03febf04 100644 --- a/.kokoro/docs/common.cfg +++ b/.kokoro/docs/common.cfg @@ -11,7 +11,7 @@ action { gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "dialogflow-python-client-v2/.kokoro/trampoline_v2.sh" +build_file: "python-dialogflow/.kokoro/trampoline_v2.sh" # Configure the docker image for kokoro-trampoline. env_vars: { @@ -20,7 +20,7 @@ env_vars: { } env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/dialogflow-python-client-v2/.kokoro/publish-docs.sh" + value: "github/python-dialogflow/.kokoro/publish-docs.sh" } env_vars: { diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg index ef672c96e..76c8fc565 100644 --- a/.kokoro/presubmit/common.cfg +++ b/.kokoro/presubmit/common.cfg @@ -14,7 +14,7 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-python" # Use the trampoline script to run in docker. -build_file: "dialogflow-python-client-v2/.kokoro/trampoline.sh" +build_file: "python-dialogflow/.kokoro/trampoline.sh" # Configure the docker image for kokoro-trampoline. env_vars: { @@ -23,5 +23,5 @@ env_vars: { } env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/dialogflow-python-client-v2/.kokoro/build.sh" + value: "github/python-dialogflow/.kokoro/build.sh" } diff --git a/.kokoro/release.sh b/.kokoro/release.sh index a573045a5..836c14c7f 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -27,6 +27,6 @@ export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password") -cd github/dialogflow-python-client-v2 +cd github/python-dialogflow python3 setup.py sdist bdist_wheel twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index b8cf8768f..d9a882620 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -11,7 +11,7 @@ action { gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "dialogflow-python-client-v2/.kokoro/trampoline.sh" +build_file: "python-dialogflow/.kokoro/trampoline.sh" # Configure the docker image for kokoro-trampoline. env_vars: { @@ -20,7 +20,7 @@ env_vars: { } env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/dialogflow-python-client-v2/.kokoro/release.sh" + value: "github/python-dialogflow/.kokoro/release.sh" } # Fetch PyPI password diff --git a/.kokoro/samples/lint/common.cfg b/.kokoro/samples/lint/common.cfg index eb9ca02f3..5879caec3 100644 --- a/.kokoro/samples/lint/common.cfg +++ b/.kokoro/samples/lint/common.cfg @@ -15,7 +15,7 @@ env_vars: { env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/dialogflow-python-client-v2/.kokoro/test-samples.sh" + value: "github/python-dialogflow/.kokoro/test-samples.sh" } # Configure the docker image for kokoro-trampoline. @@ -31,4 +31,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "dialogflow-python-client-v2/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-dialogflow/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.6/common.cfg b/.kokoro/samples/python3.6/common.cfg index c29a70c6f..e3daafd4b 100644 --- a/.kokoro/samples/python3.6/common.cfg +++ b/.kokoro/samples/python3.6/common.cfg @@ -21,7 +21,7 @@ env_vars: { env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/dialogflow-python-client-v2/.kokoro/test-samples.sh" + value: "github/python-dialogflow/.kokoro/test-samples.sh" } # Configure the docker image for kokoro-trampoline. @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "dialogflow-python-client-v2/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-dialogflow/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.7/common.cfg b/.kokoro/samples/python3.7/common.cfg index 8698a7deb..e7a49f99c 100644 --- a/.kokoro/samples/python3.7/common.cfg +++ b/.kokoro/samples/python3.7/common.cfg @@ -21,7 +21,7 @@ env_vars: { env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/dialogflow-python-client-v2/.kokoro/test-samples.sh" + value: "github/python-dialogflow/.kokoro/test-samples.sh" } # Configure the docker image for kokoro-trampoline. @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "dialogflow-python-client-v2/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-dialogflow/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.8/common.cfg b/.kokoro/samples/python3.8/common.cfg index 7c19fc300..ff4f743a8 100644 --- a/.kokoro/samples/python3.8/common.cfg +++ b/.kokoro/samples/python3.8/common.cfg @@ -21,7 +21,7 @@ env_vars: { env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/dialogflow-python-client-v2/.kokoro/test-samples.sh" + value: "github/python-dialogflow/.kokoro/test-samples.sh" } # Configure the docker image for kokoro-trampoline. @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "dialogflow-python-client-v2/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-dialogflow/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index fe08751d6..96c719f54 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -20,7 +20,7 @@ set -eo pipefail # Enables `**` to include files nested inside sub-folders shopt -s globstar -cd github/dialogflow-python-client-v2 +cd github/python-dialogflow # Run periodic samples tests at latest release if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..6ad83346e --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml +- repo: https://github.com/psf/black + rev: 19.10b0 + hooks: + - id: black +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.4 + hooks: + - id: flake8 diff --git a/.repo-metadata.json b/.repo-metadata.json index 00d50fee7..9be62d8e9 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -6,8 +6,8 @@ "issue_tracker": "https://issuetracker.google.com/savedsearches/5300385", "release_level": "ga", "language": "python", - "repo": "googleapis/dialogflow-python-client-v2", - "distribution_name": "dialogflow", + "repo": "googleapis/python-dialogflow", + "distribution_name": "google-cloud-dialogflow", "api_id": "dialogflow.googleapis.com", "requires_billing": true } \ No newline at end of file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 06f69f64c..2e5c52884 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -35,21 +35,21 @@ Using a Development Checkout You'll have to create a development environment using a Git checkout: - While logged into your GitHub account, navigate to the - ``dialogflow-python-client-v2`` `repo`_ on GitHub. + ``python-dialogflow`` `repo`_ on GitHub. -- Fork and clone the ``dialogflow-python-client-v2`` repository to your GitHub account by +- Fork and clone the ``python-dialogflow`` repository to your GitHub account by clicking the "Fork" button. -- Clone your fork of ``dialogflow-python-client-v2`` from your GitHub account to your local +- Clone your fork of ``python-dialogflow`` from your GitHub account to your local computer, substituting your account username and specifying the destination - as ``hack-on-dialogflow-python-client-v2``. E.g.:: + as ``hack-on-python-dialogflow``. E.g.:: $ cd ${HOME} - $ git clone git@github.com:USERNAME/dialogflow-python-client-v2.git hack-on-dialogflow-python-client-v2 - $ cd hack-on-dialogflow-python-client-v2 - # Configure remotes such that you can pull changes from the googleapis/dialogflow-python-client-v2 + $ git clone git@github.com:USERNAME/python-dialogflow.git hack-on-python-dialogflow + $ cd hack-on-python-dialogflow + # Configure remotes such that you can pull changes from the googleapis/python-dialogflow # repository into your local repository. - $ git remote add upstream git@github.com:googleapis/dialogflow-python-client-v2.git + $ git remote add upstream git@github.com:googleapis/python-dialogflow.git # fetch and merge changes from upstream into master $ git fetch upstream $ git merge upstream/master @@ -60,7 +60,7 @@ repo, from which you can submit a pull request. To work on the codebase and run the tests, we recommend using ``nox``, but you can also use a ``virtualenv`` of your own creation. -.. _repo: https://github.com/googleapis/dialogflow-python-client-v2 +.. _repo: https://github.com/googleapis/python-dialogflow Using ``nox`` ============= @@ -107,10 +107,20 @@ Coding Style export GOOGLE_CLOUD_TESTING_BRANCH="master" By doing this, you are specifying the location of the most up-to-date - version of ``dialogflow-python-client-v2``. The the suggested remote name ``upstream`` + version of ``python-dialogflow``. The the suggested remote name ``upstream`` should point to the official ``googleapis`` checkout and the the branch should be the main branch on that remote (``master``). +- This repository contains configuration for the + `pre-commit `__ tool, which automates checking + our linters during a commit. If you have it installed on your ``$PATH``, + you can enable enforcing those checks via: + +.. code-block:: bash + + $ pre-commit install + pre-commit installed at .git/hooks/pre-commit + Exceptions to PEP8: - Many unit tests use a helper method, ``_call_fut`` ("FUT" is short for @@ -180,10 +190,10 @@ The `description on PyPI`_ for the project comes directly from the ``README``. Due to the reStructuredText (``rst``) parser used by PyPI, relative links which will work on GitHub (e.g. ``CONTRIBUTING.rst`` instead of -``https://github.com/googleapis/dialogflow-python-client-v2/blob/master/CONTRIBUTING.rst``) +``https://github.com/googleapis/python-dialogflow/blob/master/CONTRIBUTING.rst``) may cause problems creating links or rendering the description. -.. _description on PyPI: https://pypi.org/project/dialogflow +.. _description on PyPI: https://pypi.org/project/google-cloud-dialogflow ************************* @@ -205,7 +215,7 @@ We support: Supported versions can be found in our ``noxfile.py`` `config`_. -.. _config: https://github.com/googleapis/dialogflow-python-client-v2/blob/master/noxfile.py +.. _config: https://github.com/googleapis/python-dialogflow/blob/master/noxfile.py Python 2.7 support is deprecated. All code changes should maintain Python 2.7 compatibility until January 1, 2020. diff --git a/README.rst b/README.rst index a6de1f722..3f197fae8 100644 --- a/README.rst +++ b/README.rst @@ -1,23 +1,28 @@ Dialogflow: Python Client ========================= -|release level| +|ga| |pypi| |versions| - Python idiomatic client for `Dialogflow`_ + Python idiomatic client for `Dialogflow ES`_ -`Dialogflow`_ is an enterprise-grade NLU platform that makes it easy for +`Dialogflow ES`_ is an enterprise-grade NLU platform that makes it easy for developers to design and integrate conversational user interfaces into mobile apps, web applications, devices, and bots. -* `Dialogflow Python Client API Reference `_ -* `Dialogflow Standard Edition Documentation `_ -* `Dialogflow Enterprise Edition Documentation `_ +* `Dialogflow ES Python Client API Reference `_ +* `Dialogflow ES Documentation `_ Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in `Client Libraries Explained `_. -.. _Dialogflow: https://dialogflow.com/ +.. |ga| image:: https://img.shields.io/badge/support-ga-gold.svg + :target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#ga-support +.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-dialogflow.svg + :target: https://pypi.org/project/google-cloud-dialogflow/ +.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-dialogflow.svg + :target: https://pypi.org/project/google-cloud-dialogflow/ +.. _Dialogflow ES: https://cloud.google.com/dialogflow/docs/ Before you begin @@ -40,7 +45,7 @@ Installation .. code-block:: shell - pip install dialogflow + pip install google-cloud-dialogflow .. note:: @@ -50,11 +55,11 @@ Installation Supported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^ -Python >= 3.5 +Python >= 3.6 -Deprecated Python Versions -^^^^^^^^^^^^^^^^^^^^^^^^^^ -Python == 2.7. Python 2.7 support will be removed on January 1, 2020. +Unsupported Python Versions +^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The last version of this library compatible with Python 2.7 is dialogflow==1.1.0. Usage @@ -84,8 +89,4 @@ License Apache Version 2.0 -See `the LICENSE file `_ for more information. - - -.. |release level| image:: https://img.shields.io/badge/support-GA-gold.svg - :target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#general-availability \ No newline at end of file +See `the LICENSE file `_ for more information. \ No newline at end of file diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 000000000..7fe4a8b31 --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,251 @@ +# 2.0.0 Migration Guide + +The 2.0 release of the `google-cloud-dialogflow` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library will likely require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage. + +If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-dialogflow/issues). + + +## Package import and naming +> **WARNING**: Breaking change + +The 2.0.0 release changes the name and import path of the library to fall under the google-cloud namespace. + +No further updates will be made to the package [dialogflow](https://pypi.org/project/dialogflow/) on PyPI. + +**Before:** + +```sh +python3 -m pip install dialogflow +``` + +```py +import dialogflow +``` + +**After:** + +```sh +python3 -m pip install google-cloud-dialogflow +``` + +```py +from google.cloud import dialogflow +``` + + +## Supported Python Versions +> **WARNING**: Breaking change + +The 2.0.0 release requires Python 3.6+. + +## Method Calls +> **WARNING**: Breaking change + +Methods expect request objects. We provide a script that will convert most common use cases. + +* Install the library +```sh +$ python3 -m pip install google-cloud-dialogflow +``` +* The scripts `fixup_dialogflow_v2_keywords.py` and `fixup_dialogflow_v2beta1_keywords.py` are shipped with the library. It expects an input directory (with the code to convert) and an empty destination directory. + +```sh +$ fixup_dialogflow_v2_keywords.py --input-directory .samples/ --output-directory samples/ +``` +**Before:** + +```py +import dialogflow +client = dialogflow.ContextsClient() + +response = client.list_contexts(parent="projects/1337/agent/sessions/1024") +``` + +**After:** +```py +from google.cloud import dialogflow + +client = dialogflow.ContextsClient() + +response = client.list_contexts(request={"parent": "projects/1337/agent/sessions/1024", page_size=10}) +``` + +### More Details +In google-cloud-dialogflow<2.0.0, parameters required by the API were positional parameters and optional parameters were keyword parameters. + +**Before:** +```py + def detect_intent( + self, + session, + query_input, + query_params=None, + output_audio_config=None, + output_audio_config_mask=None, + input_audio=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): +``` + +In the 2.0.0 release, all methods have a single positional parameter request. Method docstrings indicate whether a parameter is required or optional. + +Some methods have additional keyword only parameters. The available parameters depend on the [`google.api.method_signature` annotation](https://github.com/googleapis/googleapis/blob/master/google/cloud/translate/v3/translation_service.proto#L55) specified by the API producer. + +**After:**: +```py + def detect_intent(self, + request=None, + *, + session: str=None, + query_input=None, + retry=gapic_v1.method.DEFAULT, + timeout=None, + metadata=(), + ): +``` + +> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive. Passing both will result in an error. + +Both of these calls are valid: +```py +response = client.create_context( + request={ + "parent": "parent_value", + "context": dialogflow.Context(name="name_value"), + } +) +response = client.create_context( + parent="parent_value", + context=dialogflow.Context(name="name_value"), +) +``` + +This call is invalid because it mixes `request` with a keyword argument `audio_config`. Executing this code will result in an error. + +```py +response = client.create_context( + request={ + "parent": "parent_value", + }, + context=dialogflow.Context(name="name_value"), +) +``` + +## Enums and Types + +> **WARNING:** Breaking change + +The submodules `enums` and `types` have been removed in the versionless module. + +**Before:** + +```py +import dialogflow + +encoding = dialogflow.enums.AudioEncoding.AUDIO_ENCODING_FLAC +query_params = dialogflow.types.QueryParameters(time_zone="Europe/Paris") +``` + +**After:** + +```py +from google.cloud import dialogflow + +encoding = dialogflow.AudioEncoding.AUDIO_ENCODING_FLAC +query_params = dialogflow.QueryParameters(time_zone="Europe/Paris") +``` + +The `types` submodule is still present in the versioned module. + +E.g. + +```py +from google.cloud import dialogvlow_v2 + +query_params = dialogvlow_v2.types.QueryParameters(time_zone="Europe/Paris") +``` + + +## Resource path helpers + +> **WARNING**: Breaking change + +Some resource path helpers have been renamed, and others have been removed. +See below for an alternative method or a string. + + +**v2** +```py +from google.cloud import dialogflow_v2 + +# AgentsClient +project_path = dialogflow_v2.AgentsClient.common_project_path("PROJECT") + +# ContextsClient +session_path = dialogflow_v2.SessionsClient.session_path("PROJECT", "SESSION") + +# EntityTypesClient +agent_path = dialogflow_v2.AgentsClient.agent_path("PROJECT") +project_agent_path = dialogflow_v2.AgentsClient.agent_path("PROJECT") + +# EnvironmentsClient +agent_path = dialogflow_v2.AgentsClient.agent_path("PROJECT") + +# IntentsClient +agent_path = dialogflow_v2.AgentsClient.agent_path("PROJECT") +project_agent_path = dialogflow_v2.AgentsClient.agent_path("PROJECT") + +# SessionEntityTypesClient +session_path = dialogflow_v2.SessionsClient.session_path("PROJECT", "SESSION") + +``` + +**v2beta1** + +```py +from google.cloud import dialogflow_v2beta1 + +context = "CONTEXT" +entity_type = "ENTITY_TYPE" +environmnent = "ENVIRONMENT" +project = "PROJECT" +session = "SESSION" +user = "USER" + +# AgentsClient +location_path = dialogflow_v2beta1.AgentsClient.common_location_path( + "PROJECT", "LOCATION" +) +project_path = dialogflow_v2beta1.AgentsClient.common_project_path("PROJECT") + +# ContextsClient +environment_context_path = f"projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" +environment_session_path = f"projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}" +session_path = dialogflow_v2beta1.SessionsClient.session_path("PROJECT", "SESSION") + +# DocumentsClient +knowledge_base_path = dialogflow_v2beta1.KnowledgeBasesClient.knowledge_base_path( + "PROJECT", "KNOWLEDGE_BASE" +) + +# EnvironmentsClient +agent_path = dialogflow_v2beta1.AgentsClient.agent_path("PROJECT") + +# IntentsClient +agent_path = dialogflow_v2beta1.AgentsClient.agent_path("PROJECT") +project_path = dialogflow_v2beta1.AgentsClient.common_project_path("PROJECT") + +# KnowledgeBasesClient +project_path = dialogflow_v2beta1.KnowledgeBasesClient.common_project_path("PROJECT") + +# SessionEntityTypesClient +environment_session_path = f"projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}" +environment_sessions_entity_path = f"projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" +session_path = f"projects/{project}/agent/sessions/{session}" + + +# SessionsClient +environment_session_path = f"projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}" +``` \ No newline at end of file diff --git a/dialogflow_v2/__init__.py b/dialogflow_v2/__init__.py deleted file mode 100644 index 2181eae23..000000000 --- a/dialogflow_v2/__init__.py +++ /dev/null @@ -1,87 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -from __future__ import absolute_import -import sys -import warnings - -from dialogflow_v2 import types -from dialogflow_v2.gapic import agents_client -from dialogflow_v2.gapic import contexts_client -from dialogflow_v2.gapic import entity_types_client -from dialogflow_v2.gapic import enums -from dialogflow_v2.gapic import environments_client -from dialogflow_v2.gapic import intents_client -from dialogflow_v2.gapic import session_entity_types_client -from dialogflow_v2.gapic import sessions_client - - -if sys.version_info[:2] == (2, 7): - message = ( - "A future version of this library will drop support for Python 2.7. " - "More details about Python 2 support for Google Cloud Client Libraries " - "can be found at https://cloud.google.com/python/docs/python2-sunset/" - ) - warnings.warn(message, DeprecationWarning) - - -class AgentsClient(agents_client.AgentsClient): - __doc__ = agents_client.AgentsClient.__doc__ - enums = enums - - -class ContextsClient(contexts_client.ContextsClient): - __doc__ = contexts_client.ContextsClient.__doc__ - enums = enums - - -class EntityTypesClient(entity_types_client.EntityTypesClient): - __doc__ = entity_types_client.EntityTypesClient.__doc__ - enums = enums - - -class EnvironmentsClient(environments_client.EnvironmentsClient): - __doc__ = environments_client.EnvironmentsClient.__doc__ - enums = enums - - -class IntentsClient(intents_client.IntentsClient): - __doc__ = intents_client.IntentsClient.__doc__ - enums = enums - - -class SessionEntityTypesClient(session_entity_types_client.SessionEntityTypesClient): - __doc__ = session_entity_types_client.SessionEntityTypesClient.__doc__ - enums = enums - - -class SessionsClient(sessions_client.SessionsClient): - __doc__ = sessions_client.SessionsClient.__doc__ - enums = enums - - -__all__ = ( - "enums", - "types", - "AgentsClient", - "ContextsClient", - "EntityTypesClient", - "EnvironmentsClient", - "IntentsClient", - "SessionEntityTypesClient", - "SessionsClient", -) diff --git a/dialogflow_v2/gapic/__init__.py b/dialogflow_v2/gapic/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/dialogflow_v2/gapic/agents_client.py b/dialogflow_v2/gapic/agents_client.py deleted file mode 100644 index b71ee653b..000000000 --- a/dialogflow_v2/gapic/agents_client.py +++ /dev/null @@ -1,1004 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2 Agents API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.operation -import google.api_core.operations_v1 -import google.api_core.page_iterator -import google.api_core.path_template -import google.api_core.protobuf_helpers -import grpc - -from dialogflow_v2.gapic import agents_client_config -from dialogflow_v2.gapic import enums -from dialogflow_v2.gapic.transports import agents_grpc_transport -from dialogflow_v2.proto import agent_pb2 -from dialogflow_v2.proto import agent_pb2_grpc -from dialogflow_v2.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class AgentsClient(object): - """Service for managing ``Agents``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2.Agents" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2.AgentsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def project_path(cls, project): - """Return a fully-qualified project string.""" - return google.api_core.path_template.expand( - "projects/{project}", project=project - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.AgentsGrpcTransport, - Callable[[~.Credentials, type], ~.AgentsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = agents_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=agents_grpc_transport.AgentsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = agents_grpc_transport.AgentsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def get_agent( - self, - parent, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified agent. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.get_agent(parent) - - Args: - parent (str): Required. The project that the agent to fetch is associated with. - Format: ``projects/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.Agent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "get_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_agent, - default_retry=self._method_configs["GetAgent"].retry, - default_timeout=self._method_configs["GetAgent"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.GetAgentRequest(parent=parent) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def set_agent( - self, - agent, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates/updates the specified agent. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.AgentsClient() - >>> - >>> # TODO: Initialize `agent`: - >>> agent = {} - >>> - >>> response = client.set_agent(agent) - - Args: - agent (Union[dict, ~google.cloud.dialogflow_v2.types.Agent]): Required. The agent to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.Agent` - update_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.Agent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "set_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "set_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.set_agent, - default_retry=self._method_configs["SetAgent"].retry, - default_timeout=self._method_configs["SetAgent"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.SetAgentRequest(agent=agent, update_mask=update_mask) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("agent.parent", agent.parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["set_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_agent( - self, - parent, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified agent. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> client.delete_agent(parent) - - Args: - parent (str): Required. The project that the agent to delete is associated with. - Format: ``projects/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_agent, - default_retry=self._method_configs["DeleteAgent"].retry, - default_timeout=self._method_configs["DeleteAgent"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.DeleteAgentRequest(parent=parent) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def search_agents( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of agents. - - Since there is at most one conversational agent per project, this method - is useful primarily for listing all agents across projects the caller - has access to. One can achieve that with a wildcard project collection - id "-". Refer to `List - Sub-Collections `__. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> # Iterate over all results - >>> for element in client.search_agents(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.search_agents(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The project to list agents from. Format: - ``projects/``. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2.types.Agent` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "search_agents" not in self._inner_api_calls: - self._inner_api_calls[ - "search_agents" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.search_agents, - default_retry=self._method_configs["SearchAgents"].retry, - default_timeout=self._method_configs["SearchAgents"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.SearchAgentsRequest(parent=parent, page_size=page_size) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["search_agents"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="agents", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def train_agent( - self, - parent, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Trains the specified agent. - - Operation - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.train_agent(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The project that the agent to train is associated with. - Format: ``projects/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "train_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "train_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.train_agent, - default_retry=self._method_configs["TrainAgent"].retry, - default_timeout=self._method_configs["TrainAgent"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.TrainAgentRequest(parent=parent) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["train_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def export_agent( - self, - parent, - agent_uri=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Exports the specified agent to a ZIP file. - - Operation - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> # TODO: Initialize `agent_uri`: - >>> agent_uri = '' - >>> - >>> response = client.export_agent(parent, agent_uri) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The project that the agent to export is associated with. - Format: ``projects/``. - agent_uri (str): Required. The `Google Cloud - Storage `__ URI to export the - agent to. The format of this URI must be - ``gs:///``. If left unspecified, the - serialized agent is returned inline. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "export_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "export_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.export_agent, - default_retry=self._method_configs["ExportAgent"].retry, - default_timeout=self._method_configs["ExportAgent"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.ExportAgentRequest(parent=parent, agent_uri=agent_uri) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["export_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - agent_pb2.ExportAgentResponse, - metadata_type=struct_pb2.Struct, - ) - - def import_agent( - self, - parent, - agent_uri=None, - agent_content=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Imports the specified agent from a ZIP file. - - Uploads new intents and entity types without deleting the existing ones. - Intents and entity types with the same name are replaced with the new - versions from ``ImportAgentRequest``. After the import, the imported - draft agent will be trained automatically (unless disabled in agent - settings). However, once the import is done, training may not be - completed yet. Please call ``TrainAgent`` and wait for the operation it - returns in order to train explicitly. - - Operation An operation which - tracks when importing is complete. It only tracks when the draft agent - is updated not when it is done training. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.import_agent(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The project that the agent to import is associated with. - Format: ``projects/``. - agent_uri (str): The URI to a Google Cloud Storage file containing the agent to import. - Note: The URI must start with "gs://". - agent_content (bytes): Zip compressed raw byte content for agent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "import_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "import_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.import_agent, - default_retry=self._method_configs["ImportAgent"].retry, - default_timeout=self._method_configs["ImportAgent"].timeout, - client_info=self._client_info, - ) - - # Sanity check: We have some fields which are mutually exclusive; - # raise ValueError if more than one is sent. - google.api_core.protobuf_helpers.check_oneof( - agent_uri=agent_uri, agent_content=agent_content - ) - - request = agent_pb2.ImportAgentRequest( - parent=parent, agent_uri=agent_uri, agent_content=agent_content - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["import_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def restore_agent( - self, - parent, - agent_uri=None, - agent_content=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Restores the specified agent from a ZIP file. - - Replaces the current agent version with a new one. All the intents and - entity types in the older version are deleted. After the restore, the - restored draft agent will be trained automatically (unless disabled in - agent settings). However, once the restore is done, training may not be - completed yet. Please call ``TrainAgent`` and wait for the operation it - returns in order to train explicitly. - - Operation An operation which - tracks when restoring is complete. It only tracks when the draft agent - is updated not when it is done training. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.restore_agent(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The project that the agent to restore is associated with. - Format: ``projects/``. - agent_uri (str): The URI to a Google Cloud Storage file containing the agent to restore. - Note: The URI must start with "gs://". - agent_content (bytes): Zip compressed raw byte content for agent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "restore_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "restore_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.restore_agent, - default_retry=self._method_configs["RestoreAgent"].retry, - default_timeout=self._method_configs["RestoreAgent"].timeout, - client_info=self._client_info, - ) - - # Sanity check: We have some fields which are mutually exclusive; - # raise ValueError if more than one is sent. - google.api_core.protobuf_helpers.check_oneof( - agent_uri=agent_uri, agent_content=agent_content - ) - - request = agent_pb2.RestoreAgentRequest( - parent=parent, agent_uri=agent_uri, agent_content=agent_content - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["restore_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def get_validation_result( - self, - parent=None, - language_code=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Gets agent validation result. Agent validation is performed during - training time and is updated automatically when training is completed. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.get_validation_result(parent) - - Args: - parent (str): Required. The project that the agent is associated with. Format: - ``projects/``. - language_code (str): Optional. The language for which you want a validation result. If - not specified, the agent's default language is used. `Many - languages `__ - are supported. Note: languages must be enabled in the agent before they - can be used. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.ValidationResult` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_validation_result" not in self._inner_api_calls: - self._inner_api_calls[ - "get_validation_result" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_validation_result, - default_retry=self._method_configs["GetValidationResult"].retry, - default_timeout=self._method_configs["GetValidationResult"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.GetValidationResultRequest( - parent=parent, language_code=language_code - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_validation_result"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/dialogflow_v2/gapic/agents_client_config.py b/dialogflow_v2/gapic/agents_client_config.py deleted file mode 100644 index 69aa6b3e0..000000000 --- a/dialogflow_v2/gapic/agents_client_config.py +++ /dev/null @@ -1,97 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2.Agents": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "GetAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "SetAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "SearchAgents": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "TrainAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "ExportAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "ImportAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "RestoreAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetValidationResult": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2/gapic/contexts_client.py b/dialogflow_v2/gapic/contexts_client.py deleted file mode 100644 index c0592c94a..000000000 --- a/dialogflow_v2/gapic/contexts_client.py +++ /dev/null @@ -1,704 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2 Contexts API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from dialogflow_v2.gapic import contexts_client_config -from dialogflow_v2.gapic import enums -from dialogflow_v2.gapic.transports import contexts_grpc_transport -from dialogflow_v2.proto import agent_pb2 -from dialogflow_v2.proto import agent_pb2_grpc -from dialogflow_v2.proto import context_pb2 -from dialogflow_v2.proto import context_pb2_grpc -from dialogflow_v2.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class ContextsClient(object): - """Service for managing ``Contexts``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2.Contexts" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2.ContextsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def context_path(cls, project, session, context): - """Return a fully-qualified context string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/sessions/{session}/contexts/{context}", - project=project, - session=session, - context=context, - ) - - @classmethod - def session_path(cls, project, session): - """Return a fully-qualified session string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/sessions/{session}", - project=project, - session=session, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.ContextsGrpcTransport, - Callable[[~.Credentials, type], ~.ContextsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = contexts_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=contexts_grpc_transport.ContextsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = contexts_grpc_transport.ContextsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_contexts( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all contexts in the specified session. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.ContextsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # Iterate over all results - >>> for element in client.list_contexts(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_contexts(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The session to list all contexts from. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users//sessions/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2.types.Context` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_contexts" not in self._inner_api_calls: - self._inner_api_calls[ - "list_contexts" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_contexts, - default_retry=self._method_configs["ListContexts"].retry, - default_timeout=self._method_configs["ListContexts"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.ListContextsRequest(parent=parent, page_size=page_size) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_contexts"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="contexts", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def get_context( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified context. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.ContextsClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> response = client.get_context(name) - - Args: - name (str): Required. The name of the context. Format: - ``projects//agent/sessions//contexts/`` - or - ``projects//agent/environments//users//sessions//contexts/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.Context` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_context" not in self._inner_api_calls: - self._inner_api_calls[ - "get_context" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_context, - default_retry=self._method_configs["GetContext"].retry, - default_timeout=self._method_configs["GetContext"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.GetContextRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_context"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_context( - self, - parent, - context, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a context. - - If the specified context already exists, overrides the context. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.ContextsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `context`: - >>> context = {} - >>> - >>> response = client.create_context(parent, context) - - Args: - parent (str): Required. The session to create a context for. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users//sessions/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - context (Union[dict, ~google.cloud.dialogflow_v2.types.Context]): Required. The context to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.Context` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.Context` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_context" not in self._inner_api_calls: - self._inner_api_calls[ - "create_context" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_context, - default_retry=self._method_configs["CreateContext"].retry, - default_timeout=self._method_configs["CreateContext"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.CreateContextRequest(parent=parent, context=context) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_context"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_context( - self, - context, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified context. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.ContextsClient() - >>> - >>> # TODO: Initialize `context`: - >>> context = {} - >>> - >>> response = client.update_context(context) - - Args: - context (Union[dict, ~google.cloud.dialogflow_v2.types.Context]): Required. The context to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.Context` - update_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.Context` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_context" not in self._inner_api_calls: - self._inner_api_calls[ - "update_context" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_context, - default_retry=self._method_configs["UpdateContext"].retry, - default_timeout=self._method_configs["UpdateContext"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.UpdateContextRequest( - context=context, update_mask=update_mask - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("context.name", context.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_context"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_context( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified context. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.ContextsClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> client.delete_context(name) - - Args: - name (str): Required. The name of the context to delete. Format: - ``projects//agent/sessions//contexts/`` - or - ``projects//agent/environments//users//sessions//contexts/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_context" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_context" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_context, - default_retry=self._method_configs["DeleteContext"].retry, - default_timeout=self._method_configs["DeleteContext"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.DeleteContextRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_context"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_all_contexts( - self, - parent, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes all active contexts in the specified session. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.ContextsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> client.delete_all_contexts(parent) - - Args: - parent (str): Required. The name of the session to delete all contexts from. - Format: ``projects//agent/sessions/`` or - ``projects//agent/environments//users//sessions/``. - If ``Environment ID`` is not specified we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_all_contexts" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_all_contexts" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_all_contexts, - default_retry=self._method_configs["DeleteAllContexts"].retry, - default_timeout=self._method_configs["DeleteAllContexts"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.DeleteAllContextsRequest(parent=parent) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_all_contexts"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/dialogflow_v2/gapic/contexts_client_config.py b/dialogflow_v2/gapic/contexts_client_config.py deleted file mode 100644 index 76d84ffba..000000000 --- a/dialogflow_v2/gapic/contexts_client_config.py +++ /dev/null @@ -1,82 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2.Contexts": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListContexts": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetContext": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "CreateContext": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateContext": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteContext": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteAllContexts": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2/gapic/entity_types_client.py b/dialogflow_v2/gapic/entity_types_client.py deleted file mode 100644 index fe8f0d29d..000000000 --- a/dialogflow_v2/gapic/entity_types_client.py +++ /dev/null @@ -1,1176 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2 EntityTypes API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.operation -import google.api_core.operations_v1 -import google.api_core.page_iterator -import google.api_core.path_template -import google.api_core.protobuf_helpers -import grpc - -from dialogflow_v2.gapic import entity_types_client_config -from dialogflow_v2.gapic import enums -from dialogflow_v2.gapic.transports import entity_types_grpc_transport -from dialogflow_v2.proto import agent_pb2 -from dialogflow_v2.proto import agent_pb2_grpc -from dialogflow_v2.proto import context_pb2 -from dialogflow_v2.proto import context_pb2_grpc -from dialogflow_v2.proto import entity_type_pb2 -from dialogflow_v2.proto import entity_type_pb2_grpc -from dialogflow_v2.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class EntityTypesClient(object): - """Service for managing ``EntityTypes``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2.EntityTypes" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2.EntityTypesClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def project_agent_path(cls, project): - """Return a fully-qualified project_agent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent", project=project - ) - - @classmethod - def agent_path(cls, project): - """Return a fully-qualified agent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent", project=project - ) - - @classmethod - def entity_type_path(cls, project, entity_type): - """Return a fully-qualified entity_type string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/entityTypes/{entity_type}", - project=project, - entity_type=entity_type, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.EntityTypesGrpcTransport, - Callable[[~.Credentials, type], ~.EntityTypesGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = entity_types_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=entity_types_grpc_transport.EntityTypesGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = entity_types_grpc_transport.EntityTypesGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_entity_types( - self, - parent, - language_code=None, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all entity types in the specified agent. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EntityTypesClient() - >>> - >>> parent = client.agent_path('[PROJECT]') - >>> - >>> # Iterate over all results - >>> for element in client.list_entity_types(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_entity_types(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The agent to list all entity types from. Format: - ``projects//agent``. - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2.types.EntityType` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_entity_types" not in self._inner_api_calls: - self._inner_api_calls[ - "list_entity_types" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_entity_types, - default_retry=self._method_configs["ListEntityTypes"].retry, - default_timeout=self._method_configs["ListEntityTypes"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.ListEntityTypesRequest( - parent=parent, language_code=language_code, page_size=page_size - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_entity_types"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="entity_types", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def get_entity_type( - self, - name, - language_code=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified entity type. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EntityTypesClient() - >>> - >>> name = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]') - >>> - >>> response = client.get_entity_type(name) - - Args: - name (str): Required. The name of the entity type. Format: - ``projects//agent/entityTypes/``. - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.EntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "get_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_entity_type, - default_retry=self._method_configs["GetEntityType"].retry, - default_timeout=self._method_configs["GetEntityType"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.GetEntityTypeRequest( - name=name, language_code=language_code - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_entity_type( - self, - parent, - entity_type, - language_code=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates an entity type in the specified agent. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EntityTypesClient() - >>> - >>> parent = client.agent_path('[PROJECT]') - >>> - >>> # TODO: Initialize `entity_type`: - >>> entity_type = {} - >>> - >>> response = client.create_entity_type(parent, entity_type) - - Args: - parent (str): Required. The agent to create a entity type for. Format: - ``projects//agent``. - entity_type (Union[dict, ~google.cloud.dialogflow_v2.types.EntityType]): Required. The entity type to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.EntityType` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.EntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "create_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_entity_type, - default_retry=self._method_configs["CreateEntityType"].retry, - default_timeout=self._method_configs["CreateEntityType"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.CreateEntityTypeRequest( - parent=parent, entity_type=entity_type, language_code=language_code - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_entity_type( - self, - entity_type, - language_code=None, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified entity type. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EntityTypesClient() - >>> - >>> # TODO: Initialize `entity_type`: - >>> entity_type = {} - >>> - >>> response = client.update_entity_type(entity_type) - - Args: - entity_type (Union[dict, ~google.cloud.dialogflow_v2.types.EntityType]): Required. The entity type to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.EntityType` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - update_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.EntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "update_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_entity_type, - default_retry=self._method_configs["UpdateEntityType"].retry, - default_timeout=self._method_configs["UpdateEntityType"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.UpdateEntityTypeRequest( - entity_type=entity_type, - language_code=language_code, - update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("entity_type.name", entity_type.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_entity_type( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified entity type. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EntityTypesClient() - >>> - >>> name = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]') - >>> - >>> client.delete_entity_type(name) - - Args: - name (str): Required. The name of the entity type to delete. Format: - ``projects//agent/entityTypes/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_entity_type, - default_retry=self._method_configs["DeleteEntityType"].retry, - default_timeout=self._method_configs["DeleteEntityType"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.DeleteEntityTypeRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def batch_update_entity_types( - self, - parent, - entity_type_batch_uri=None, - entity_type_batch_inline=None, - language_code=None, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates/Creates multiple entity types in the specified agent. - - Operation - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EntityTypesClient() - >>> - >>> parent = client.agent_path('[PROJECT]') - >>> - >>> response = client.batch_update_entity_types(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the agent to update or create entity types in. - Format: ``projects//agent``. - entity_type_batch_uri (str): The URI to a Google Cloud Storage file containing entity types to update - or create. The file format can either be a serialized proto (of - EntityBatch type) or a JSON object. Note: The URI must start with - "gs://". - entity_type_batch_inline (Union[dict, ~google.cloud.dialogflow_v2.types.EntityTypeBatch]): The collection of entity types to update or create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.EntityTypeBatch` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - update_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_update_entity_types" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_update_entity_types" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_update_entity_types, - default_retry=self._method_configs["BatchUpdateEntityTypes"].retry, - default_timeout=self._method_configs["BatchUpdateEntityTypes"].timeout, - client_info=self._client_info, - ) - - # Sanity check: We have some fields which are mutually exclusive; - # raise ValueError if more than one is sent. - google.api_core.protobuf_helpers.check_oneof( - entity_type_batch_uri=entity_type_batch_uri, - entity_type_batch_inline=entity_type_batch_inline, - ) - - request = entity_type_pb2.BatchUpdateEntityTypesRequest( - parent=parent, - entity_type_batch_uri=entity_type_batch_uri, - entity_type_batch_inline=entity_type_batch_inline, - language_code=language_code, - update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_update_entity_types"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - entity_type_pb2.BatchUpdateEntityTypesResponse, - metadata_type=struct_pb2.Struct, - ) - - def batch_delete_entity_types( - self, - parent, - entity_type_names, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes entity types in the specified agent. - - Operation - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EntityTypesClient() - >>> - >>> parent = client.agent_path('[PROJECT]') - >>> - >>> # TODO: Initialize `entity_type_names`: - >>> entity_type_names = [] - >>> - >>> response = client.batch_delete_entity_types(parent, entity_type_names) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the agent to delete all entities types for. - Format: ``projects//agent``. - entity_type_names (list[str]): Required. The names entity types to delete. All names must point to - the same agent as ``parent``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_delete_entity_types" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_delete_entity_types" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_delete_entity_types, - default_retry=self._method_configs["BatchDeleteEntityTypes"].retry, - default_timeout=self._method_configs["BatchDeleteEntityTypes"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.BatchDeleteEntityTypesRequest( - parent=parent, entity_type_names=entity_type_names - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_delete_entity_types"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def batch_create_entities( - self, - parent, - entities, - language_code=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates multiple new entities in the specified entity type. - - Operation - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EntityTypesClient() - >>> - >>> parent = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]') - >>> - >>> # TODO: Initialize `entities`: - >>> entities = [] - >>> - >>> response = client.batch_create_entities(parent, entities) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the entity type to create entities in. Format: - ``projects//agent/entityTypes/``. - entities (list[Union[dict, ~google.cloud.dialogflow_v2.types.Entity]]): Required. The entities to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.Entity` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_create_entities" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_create_entities" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_create_entities, - default_retry=self._method_configs["BatchCreateEntities"].retry, - default_timeout=self._method_configs["BatchCreateEntities"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.BatchCreateEntitiesRequest( - parent=parent, entities=entities, language_code=language_code - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_create_entities"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def batch_update_entities( - self, - parent, - entities, - language_code=None, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates or creates multiple entities in the specified entity type. - This method does not affect entities in the entity type that aren't - explicitly specified in the request. - - Operation - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EntityTypesClient() - >>> - >>> parent = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]') - >>> - >>> # TODO: Initialize `entities`: - >>> entities = [] - >>> - >>> response = client.batch_update_entities(parent, entities) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the entity type to update or create entities - in. Format: - ``projects//agent/entityTypes/``. - entities (list[Union[dict, ~google.cloud.dialogflow_v2.types.Entity]]): Required. The entities to update or create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.Entity` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - update_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_update_entities" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_update_entities" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_update_entities, - default_retry=self._method_configs["BatchUpdateEntities"].retry, - default_timeout=self._method_configs["BatchUpdateEntities"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.BatchUpdateEntitiesRequest( - parent=parent, - entities=entities, - language_code=language_code, - update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_update_entities"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def batch_delete_entities( - self, - parent, - entity_values, - language_code=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes entities in the specified entity type. - - Operation - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EntityTypesClient() - >>> - >>> parent = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]') - >>> - >>> # TODO: Initialize `entity_values`: - >>> entity_values = [] - >>> - >>> response = client.batch_delete_entities(parent, entity_values) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the entity type to delete entries for. Format: - ``projects//agent/entityTypes/``. - entity_values (list[str]): Required. The reference ``values`` of the entities to delete. Note - that these are not fully-qualified names, i.e. they don't start with - ``projects/``. - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_delete_entities" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_delete_entities" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_delete_entities, - default_retry=self._method_configs["BatchDeleteEntities"].retry, - default_timeout=self._method_configs["BatchDeleteEntities"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.BatchDeleteEntitiesRequest( - parent=parent, entity_values=entity_values, language_code=language_code - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_delete_entities"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) diff --git a/dialogflow_v2/gapic/entity_types_client_config.py b/dialogflow_v2/gapic/entity_types_client_config.py deleted file mode 100644 index 095a292f5..000000000 --- a/dialogflow_v2/gapic/entity_types_client_config.py +++ /dev/null @@ -1,102 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2.EntityTypes": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "CreateEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchUpdateEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchDeleteEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchCreateEntities": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchUpdateEntities": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchDeleteEntities": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2/gapic/enums.py b/dialogflow_v2/gapic/enums.py deleted file mode 100644 index d7d342fb3..000000000 --- a/dialogflow_v2/gapic/enums.py +++ /dev/null @@ -1,504 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Wrappers for protocol buffer enum types.""" - -import enum - - -class AudioEncoding(enum.IntEnum): - """ - Audio encoding of the audio content sent in the conversational query - request. Refer to the `Cloud Speech API - documentation `__ - for more details. - - Attributes: - AUDIO_ENCODING_UNSPECIFIED (int): Not specified. - AUDIO_ENCODING_LINEAR_16 (int): Uncompressed 16-bit signed little-endian samples (Linear PCM). - AUDIO_ENCODING_FLAC (int): ```FLAC`` `__ (Free - Lossless Audio Codec) is the recommended encoding because it is lossless - (therefore recognition is not compromised) and requires only about half - the bandwidth of ``LINEAR16``. ``FLAC`` stream encoding supports 16-bit - and 24-bit samples, however, not all fields in ``STREAMINFO`` are - supported. - AUDIO_ENCODING_MULAW (int): 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. - AUDIO_ENCODING_AMR (int): Adaptive Multi-Rate Narrowband codec. ``sample_rate_hertz`` must be - 8000. - AUDIO_ENCODING_AMR_WB (int): Adaptive Multi-Rate Wideband codec. ``sample_rate_hertz`` must be - 16000. - AUDIO_ENCODING_OGG_OPUS (int): Opus encoded audio frames in Ogg container - (`OggOpus `__). ``sample_rate_hertz`` - must be 16000. - AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE (int): Although the use of lossy encodings is not recommended, if a very - low bitrate encoding is required, ``OGG_OPUS`` is highly preferred over - Speex encoding. The `Speex `__ encoding supported by - Dialogflow API has a header byte in each block, as in MIME type - ``audio/x-speex-with-header-byte``. It is a variant of the RTP Speex - encoding defined in `RFC 5574 `__. - The stream is a sequence of blocks, one block per RTP packet. Each block - starts with a byte containing the length of the block, in bytes, - followed by one or more frames of Speex data, padded to an integral - number of bytes (octets) as specified in RFC 5574. In other words, each - RTP header is replaced with a single byte containing the block length. - Only Speex wideband is supported. ``sample_rate_hertz`` must be 16000. - """ - - AUDIO_ENCODING_UNSPECIFIED = 0 - AUDIO_ENCODING_LINEAR_16 = 1 - AUDIO_ENCODING_FLAC = 2 - AUDIO_ENCODING_MULAW = 3 - AUDIO_ENCODING_AMR = 4 - AUDIO_ENCODING_AMR_WB = 5 - AUDIO_ENCODING_OGG_OPUS = 6 - AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 - - -class IntentView(enum.IntEnum): - """ - Represents the options for views of an intent. - An intent can be a sizable object. Therefore, we provide a resource view that - does not return training phrases in the response by default. - - Attributes: - INTENT_VIEW_UNSPECIFIED (int): Training phrases field is not populated in the response. - INTENT_VIEW_FULL (int): All fields are populated. - """ - - INTENT_VIEW_UNSPECIFIED = 0 - INTENT_VIEW_FULL = 1 - - -class NullValue(enum.IntEnum): - """ - ``NullValue`` is a singleton enumeration to represent the null value - for the ``Value`` type union. - - The JSON representation for ``NullValue`` is JSON ``null``. - - Attributes: - NULL_VALUE (int): Null value. - """ - - NULL_VALUE = 0 - - -class OutputAudioEncoding(enum.IntEnum): - """ - Audio encoding of the output audio format in Text-To-Speech. - - Attributes: - OUTPUT_AUDIO_ENCODING_UNSPECIFIED (int): Not specified. - OUTPUT_AUDIO_ENCODING_LINEAR_16 (int): Uncompressed 16-bit signed little-endian samples (Linear PCM). - Audio content returned as LINEAR16 also contains a WAV header. - OUTPUT_AUDIO_ENCODING_MP3 (int): MP3 audio at 32kbps. - OUTPUT_AUDIO_ENCODING_OGG_OPUS (int): Opus encoded audio wrapped in an ogg container. The result will be a - file which can be played natively on Android, and in browsers (at least - Chrome and Firefox). The quality of the encoding is considerably higher - than MP3 while using approximately the same bitrate. - """ - - OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0 - OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1 - OUTPUT_AUDIO_ENCODING_MP3 = 2 - OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3 - - -class SpeechModelVariant(enum.IntEnum): - """ - Variant of the specified ``Speech model`` to use. - - See the `Cloud Speech - documentation `__ - for which models have different variants. For example, the "phone_call" - model has both a standard and an enhanced variant. When you use an - enhanced model, you will generally receive higher quality results than - for a standard model. - - Attributes: - SPEECH_MODEL_VARIANT_UNSPECIFIED (int): No model variant specified. In this case Dialogflow defaults to - USE_BEST_AVAILABLE. - USE_BEST_AVAILABLE (int): Use the best available variant of the ``Speech model`` that the - caller is eligible for. - - Please see the `Dialogflow - docs `__ for how - to make your project eligible for enhanced models. - USE_STANDARD (int): Use standard model variant even if an enhanced model is available. - See the `Cloud Speech - documentation `__ - for details about enhanced models. - USE_ENHANCED (int): Use an enhanced model variant: - - - If an enhanced variant does not exist for the given ``model`` and - request language, Dialogflow falls back to the standard variant. - - The `Cloud Speech - documentation `__ - describes which models have enhanced variants. - - - If the API caller isn't eligible for enhanced models, Dialogflow - returns an error. Please see the `Dialogflow - docs `__ for - how to make your project eligible. - """ - - SPEECH_MODEL_VARIANT_UNSPECIFIED = 0 - USE_BEST_AVAILABLE = 1 - USE_STANDARD = 2 - USE_ENHANCED = 3 - - -class SsmlVoiceGender(enum.IntEnum): - """ - Gender of the voice as described in `SSML voice - element `__. - - Attributes: - SSML_VOICE_GENDER_UNSPECIFIED (int): An unspecified gender, which means that the client doesn't care which - gender the selected voice will have. - SSML_VOICE_GENDER_MALE (int): A male voice. - SSML_VOICE_GENDER_FEMALE (int): A female voice. - SSML_VOICE_GENDER_NEUTRAL (int): A gender-neutral voice. - """ - - SSML_VOICE_GENDER_UNSPECIFIED = 0 - SSML_VOICE_GENDER_MALE = 1 - SSML_VOICE_GENDER_FEMALE = 2 - SSML_VOICE_GENDER_NEUTRAL = 3 - - -class Agent(object): - class ApiVersion(enum.IntEnum): - """ - API version for the agent. - - Attributes: - API_VERSION_UNSPECIFIED (int): Not specified. - API_VERSION_V1 (int): Legacy V1 API. - API_VERSION_V2 (int): V2 API. - API_VERSION_V2_BETA_1 (int): V2beta1 API. - """ - - API_VERSION_UNSPECIFIED = 0 - API_VERSION_V1 = 1 - API_VERSION_V2 = 2 - API_VERSION_V2_BETA_1 = 3 - - class MatchMode(enum.IntEnum): - """ - Match mode determines how intents are detected from user queries. - - Attributes: - MATCH_MODE_UNSPECIFIED (int): Not specified. - MATCH_MODE_HYBRID (int): Best for agents with a small number of examples in intents and/or wide - use of templates syntax and composite entities. - MATCH_MODE_ML_ONLY (int): Can be used for agents with a large number of examples in intents, - especially the ones using @sys.any or very large custom entities. - """ - - MATCH_MODE_UNSPECIFIED = 0 - MATCH_MODE_HYBRID = 1 - MATCH_MODE_ML_ONLY = 2 - - class Tier(enum.IntEnum): - """ - Represents the agent tier. - - Attributes: - TIER_UNSPECIFIED (int): Not specified. This value should never be used. - TIER_STANDARD (int): Standard tier. - TIER_ENTERPRISE (int): Enterprise tier (Essentials). - TIER_ENTERPRISE_PLUS (int): Enterprise tier (Plus). - """ - - TIER_UNSPECIFIED = 0 - TIER_STANDARD = 1 - TIER_ENTERPRISE = 2 - TIER_ENTERPRISE_PLUS = 3 - - -class EntityType(object): - class AutoExpansionMode(enum.IntEnum): - """ - Represents different entity type expansion modes. Automated expansion - allows an agent to recognize values that have not been explicitly listed in - the entity (for example, new kinds of shopping list items). - - Attributes: - AUTO_EXPANSION_MODE_UNSPECIFIED (int): Auto expansion disabled for the entity. - AUTO_EXPANSION_MODE_DEFAULT (int): Allows an agent to recognize values that have not been explicitly - listed in the entity. - """ - - AUTO_EXPANSION_MODE_UNSPECIFIED = 0 - AUTO_EXPANSION_MODE_DEFAULT = 1 - - class Kind(enum.IntEnum): - """ - Represents kinds of entities. - - Attributes: - KIND_UNSPECIFIED (int): Not specified. This value should be never used. - KIND_MAP (int): Map entity types allow mapping of a group of synonyms to a reference - value. - KIND_LIST (int): List entity types contain a set of entries that do not map to reference - values. However, list entity types can contain references to other entity - types (with or without aliases). - KIND_REGEXP (int): Regexp entity types allow to specify regular expressions in entries - values. - """ - - KIND_UNSPECIFIED = 0 - KIND_MAP = 1 - KIND_LIST = 2 - KIND_REGEXP = 3 - - -class Environment(object): - class State(enum.IntEnum): - """ - Represents an environment state. When an environment is pointed to a - new agent version, the environment is temporarily set to the ``LOADING`` - state. During that time, the environment keeps on serving the previous - version of the agent. After the new agent version is done loading, the - environment is set back to the ``RUNNING`` state. - - Attributes: - STATE_UNSPECIFIED (int): Not specified. This value is not used. - STOPPED (int): Stopped. - LOADING (int): Loading. - RUNNING (int): Running. - """ - - STATE_UNSPECIFIED = 0 - STOPPED = 1 - LOADING = 2 - RUNNING = 3 - - -class Intent(object): - class WebhookState(enum.IntEnum): - """ - Represents the different states that webhooks can be in. - - Attributes: - WEBHOOK_STATE_UNSPECIFIED (int): Webhook is disabled in the agent and in the intent. - WEBHOOK_STATE_ENABLED (int): Webhook is enabled in the agent and in the intent. - WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING (int): Webhook is enabled in the agent and in the intent. Also, each slot - filling prompt is forwarded to the webhook. - """ - - WEBHOOK_STATE_UNSPECIFIED = 0 - WEBHOOK_STATE_ENABLED = 1 - WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2 - - class TrainingPhrase(object): - class Type(enum.IntEnum): - """ - Represents different types of training phrases. - - Attributes: - TYPE_UNSPECIFIED (int): Not specified. This value should never be used. - EXAMPLE (int): Examples do not contain @-prefixed entity type names, but example parts - can be annotated with entity types. - TEMPLATE (int): Templates are not annotated with entity types, but they can contain - @-prefixed entity type names as substrings. - Template mode has been deprecated. Example mode is the only supported - way to create new training phrases. If you have existing training - phrases that you've created in template mode, those will continue to - work. - """ - - TYPE_UNSPECIFIED = 0 - EXAMPLE = 1 - TEMPLATE = 2 - - class Message(object): - class Platform(enum.IntEnum): - """ - The rich response message integration platform. See - `Integrations `__. - - Attributes: - PLATFORM_UNSPECIFIED (int): Default platform. - FACEBOOK (int): Facebook. - SLACK (int): Slack. - TELEGRAM (int): Telegram. - KIK (int): Kik. - SKYPE (int): Skype. - LINE (int): Line. - VIBER (int): Viber. - ACTIONS_ON_GOOGLE (int): Google Assistant See `Dialogflow webhook - format `__ - GOOGLE_HANGOUTS (int): Google Hangouts. - """ - - PLATFORM_UNSPECIFIED = 0 - FACEBOOK = 1 - SLACK = 2 - TELEGRAM = 3 - KIK = 4 - SKYPE = 5 - LINE = 6 - VIBER = 7 - ACTIONS_ON_GOOGLE = 8 - GOOGLE_HANGOUTS = 11 - - class MediaContent(object): - class ResponseMediaType(enum.IntEnum): - """ - Format of response media type. - - Attributes: - RESPONSE_MEDIA_TYPE_UNSPECIFIED (int): Unspecified. - AUDIO (int): Response media type is audio. - """ - - RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0 - AUDIO = 1 - - class BrowseCarouselCard(object): - class ImageDisplayOptions(enum.IntEnum): - """ - Image display options for Actions on Google. This should be used for - when the image's aspect ratio does not match the image container's - aspect ratio. - - Attributes: - IMAGE_DISPLAY_OPTIONS_UNSPECIFIED (int): Fill the gaps between the image and the image container with gray - bars. - GRAY (int): Fill the gaps between the image and the image container with gray - bars. - WHITE (int): Fill the gaps between the image and the image container with white - bars. - CROPPED (int): Image is scaled such that the image width and height match or exceed - the container dimensions. This may crop the top and bottom of the - image if the scaled image height is greater than the container - height, or crop the left and right of the image if the scaled image - width is greater than the container width. This is similar to "Zoom - Mode" on a widescreen TV when playing a 4:3 video. - BLURRED_BACKGROUND (int): Pad the gaps between image and image frame with a blurred copy of the - same image. - """ - - IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0 - GRAY = 1 - WHITE = 2 - CROPPED = 3 - BLURRED_BACKGROUND = 4 - - class BrowseCarouselCardItem(object): - class OpenUrlAction(object): - class UrlTypeHint(enum.IntEnum): - """ - Type of the URI. - - Attributes: - URL_TYPE_HINT_UNSPECIFIED (int): Unspecified - AMP_ACTION (int): Url would be an amp action - AMP_CONTENT (int): URL that points directly to AMP content, or to a canonical URL - which refers to AMP content via . - """ - - URL_TYPE_HINT_UNSPECIFIED = 0 - AMP_ACTION = 1 - AMP_CONTENT = 2 - - class ColumnProperties(object): - class HorizontalAlignment(enum.IntEnum): - """ - Text alignments within a cell. - - Attributes: - HORIZONTAL_ALIGNMENT_UNSPECIFIED (int): Text is aligned to the leading edge of the column. - LEADING (int): Text is aligned to the leading edge of the column. - CENTER (int): Text is centered in the column. - TRAILING (int): Text is aligned to the trailing edge of the column. - """ - - HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0 - LEADING = 1 - CENTER = 2 - TRAILING = 3 - - -class SessionEntityType(object): - class EntityOverrideMode(enum.IntEnum): - """ - The types of modifications for a session entity type. - - Attributes: - ENTITY_OVERRIDE_MODE_UNSPECIFIED (int): Not specified. This value should be never used. - ENTITY_OVERRIDE_MODE_OVERRIDE (int): The collection of session entities overrides the collection of entities - in the corresponding custom entity type. - ENTITY_OVERRIDE_MODE_SUPPLEMENT (int): The collection of session entities extends the collection of - entities in the corresponding custom entity type. - - Note: Even in this override mode calls to ``ListSessionEntityTypes``, - ``GetSessionEntityType``, ``CreateSessionEntityType`` and - ``UpdateSessionEntityType`` only return the additional entities added in - this session entity type. If you want to get the supplemented list, - please call ``EntityTypes.GetEntityType`` on the custom entity type and - merge. - """ - - ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0 - ENTITY_OVERRIDE_MODE_OVERRIDE = 1 - ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2 - - -class StreamingRecognitionResult(object): - class MessageType(enum.IntEnum): - """ - Type of the response message. - - Attributes: - MESSAGE_TYPE_UNSPECIFIED (int): Not specified. Should never be used. - TRANSCRIPT (int): Message contains a (possibly partial) transcript. - END_OF_SINGLE_UTTERANCE (int): Event indicates that the server has detected the end of the user's - speech utterance and expects no additional inputs. Therefore, the server - will not process additional audio (although it may subsequently return - additional results). The client should stop sending additional audio - data, half-close the gRPC connection, and wait for any additional - results until the server closes the gRPC connection. This message is - only sent if ``single_utterance`` was set to ``true``, and is not used - otherwise. - """ - - MESSAGE_TYPE_UNSPECIFIED = 0 - TRANSCRIPT = 1 - END_OF_SINGLE_UTTERANCE = 2 - - -class ValidationError(object): - class Severity(enum.IntEnum): - """ - Represents a level of severity. - - Attributes: - SEVERITY_UNSPECIFIED (int): Not specified. This value should never be used. - INFO (int): The agent doesn't follow Dialogflow best practicies. - WARNING (int): The agent may not behave as expected. - ERROR (int): The agent may experience partial failures. - CRITICAL (int): The agent may completely fail. - """ - - SEVERITY_UNSPECIFIED = 0 - INFO = 1 - WARNING = 2 - ERROR = 3 - CRITICAL = 4 diff --git a/dialogflow_v2/gapic/environments_client.py b/dialogflow_v2/gapic/environments_client.py deleted file mode 100644 index 393d5958f..000000000 --- a/dialogflow_v2/gapic/environments_client.py +++ /dev/null @@ -1,307 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2 Environments API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from dialogflow_v2.gapic import enums -from dialogflow_v2.gapic import environments_client_config -from dialogflow_v2.gapic.transports import environments_grpc_transport -from dialogflow_v2.proto import agent_pb2 -from dialogflow_v2.proto import agent_pb2_grpc -from dialogflow_v2.proto import context_pb2 -from dialogflow_v2.proto import context_pb2_grpc -from dialogflow_v2.proto import entity_type_pb2 -from dialogflow_v2.proto import entity_type_pb2_grpc -from dialogflow_v2.proto import environment_pb2 -from dialogflow_v2.proto import environment_pb2_grpc -from dialogflow_v2.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class EnvironmentsClient(object): - """Service for managing ``Environments``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2.Environments" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2.EnvironmentsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def agent_path(cls, project): - """Return a fully-qualified agent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent", project=project - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.EnvironmentsGrpcTransport, - Callable[[~.Credentials, type], ~.EnvironmentsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = environments_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=environments_grpc_transport.EnvironmentsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = environments_grpc_transport.EnvironmentsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_environments( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all non-draft environments of the specified agent. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.EnvironmentsClient() - >>> - >>> parent = client.agent_path('[PROJECT]') - >>> - >>> # Iterate over all results - >>> for element in client.list_environments(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_environments(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The agent to list all environments from. Format: - ``projects//agent``. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2.types.Environment` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_environments" not in self._inner_api_calls: - self._inner_api_calls[ - "list_environments" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_environments, - default_retry=self._method_configs["ListEnvironments"].retry, - default_timeout=self._method_configs["ListEnvironments"].timeout, - client_info=self._client_info, - ) - - request = environment_pb2.ListEnvironmentsRequest( - parent=parent, page_size=page_size - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_environments"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="environments", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator diff --git a/dialogflow_v2/gapic/environments_client_config.py b/dialogflow_v2/gapic/environments_client_config.py deleted file mode 100644 index 7ffc98679..000000000 --- a/dialogflow_v2/gapic/environments_client_config.py +++ /dev/null @@ -1,57 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2.Environments": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListEnvironments": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - } - }, - } - } -} diff --git a/dialogflow_v2/gapic/intents_client.py b/dialogflow_v2/gapic/intents_client.py deleted file mode 100644 index 0d3188689..000000000 --- a/dialogflow_v2/gapic/intents_client.py +++ /dev/null @@ -1,880 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2 Intents API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.operation -import google.api_core.operations_v1 -import google.api_core.page_iterator -import google.api_core.path_template -import google.api_core.protobuf_helpers -import grpc - -from dialogflow_v2.gapic import enums -from dialogflow_v2.gapic import intents_client_config -from dialogflow_v2.gapic.transports import intents_grpc_transport -from dialogflow_v2.proto import agent_pb2 -from dialogflow_v2.proto import agent_pb2_grpc -from dialogflow_v2.proto import context_pb2 -from dialogflow_v2.proto import context_pb2_grpc -from dialogflow_v2.proto import entity_type_pb2 -from dialogflow_v2.proto import entity_type_pb2_grpc -from dialogflow_v2.proto import environment_pb2 -from dialogflow_v2.proto import environment_pb2_grpc -from dialogflow_v2.proto import intent_pb2 -from dialogflow_v2.proto import intent_pb2_grpc -from dialogflow_v2.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class IntentsClient(object): - """Service for managing ``Intents``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2.Intents" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2.IntentsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def agent_path(cls, project, agent): - """Return a fully-qualified agent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agents/{agent}", project=project, agent=agent - ) - - @classmethod - def project_agent_path(cls, project): - """Return a fully-qualified project_agent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent", project=project - ) - - @classmethod - def intent_path(cls, project, intent): - """Return a fully-qualified intent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/intents/{intent}", project=project, intent=intent - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.IntentsGrpcTransport, - Callable[[~.Credentials, type], ~.IntentsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = intents_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=intents_grpc_transport.IntentsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = intents_grpc_transport.IntentsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_intents( - self, - parent, - language_code=None, - intent_view=None, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all intents in the specified agent. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.IntentsClient() - >>> - >>> parent = client.agent_path('[PROJECT]') - >>> - >>> # Iterate over all results - >>> for element in client.list_intents(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_intents(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The agent to list all intents from. Format: - ``projects//agent``. - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - intent_view (~google.cloud.dialogflow_v2.types.IntentView): Optional. The resource view to apply to the returned intent. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2.types.Intent` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_intents" not in self._inner_api_calls: - self._inner_api_calls[ - "list_intents" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_intents, - default_retry=self._method_configs["ListIntents"].retry, - default_timeout=self._method_configs["ListIntents"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.ListIntentsRequest( - parent=parent, - language_code=language_code, - intent_view=intent_view, - page_size=page_size, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_intents"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="intents", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def get_intent( - self, - name, - language_code=None, - intent_view=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified intent. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.IntentsClient() - >>> - >>> name = client.intent_path('[PROJECT]', '[INTENT]') - >>> - >>> response = client.get_intent(name) - - Args: - name (str): Required. The name of the intent. Format: - ``projects//agent/intents/``. - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - intent_view (~google.cloud.dialogflow_v2.types.IntentView): Optional. The resource view to apply to the returned intent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.Intent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "get_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_intent, - default_retry=self._method_configs["GetIntent"].retry, - default_timeout=self._method_configs["GetIntent"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.GetIntentRequest( - name=name, language_code=language_code, intent_view=intent_view - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_intent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_intent( - self, - parent, - intent, - language_code=None, - intent_view=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates an intent in the specified agent. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.IntentsClient() - >>> - >>> parent = client.agent_path('[PROJECT]') - >>> - >>> # TODO: Initialize `intent`: - >>> intent = {} - >>> - >>> response = client.create_intent(parent, intent) - - Args: - parent (str): Required. The agent to create a intent for. Format: - ``projects//agent``. - intent (Union[dict, ~google.cloud.dialogflow_v2.types.Intent]): Required. The intent to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.Intent` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - intent_view (~google.cloud.dialogflow_v2.types.IntentView): Optional. The resource view to apply to the returned intent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.Intent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "create_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_intent, - default_retry=self._method_configs["CreateIntent"].retry, - default_timeout=self._method_configs["CreateIntent"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.CreateIntentRequest( - parent=parent, - intent=intent, - language_code=language_code, - intent_view=intent_view, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_intent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_intent( - self, - intent, - language_code=None, - update_mask=None, - intent_view=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified intent. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.IntentsClient() - >>> - >>> # TODO: Initialize `intent`: - >>> intent = {} - >>> - >>> response = client.update_intent(intent) - - Args: - intent (Union[dict, ~google.cloud.dialogflow_v2.types.Intent]): Required. The intent to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.Intent` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - update_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.FieldMask` - intent_view (~google.cloud.dialogflow_v2.types.IntentView): Optional. The resource view to apply to the returned intent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.Intent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "update_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_intent, - default_retry=self._method_configs["UpdateIntent"].retry, - default_timeout=self._method_configs["UpdateIntent"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.UpdateIntentRequest( - intent=intent, - language_code=language_code, - update_mask=update_mask, - intent_view=intent_view, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("intent.name", intent.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_intent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_intent( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified intent and its direct or indirect followup intents. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.IntentsClient() - >>> - >>> name = client.intent_path('[PROJECT]', '[INTENT]') - >>> - >>> client.delete_intent(name) - - Args: - name (str): Required. The name of the intent to delete. If this intent has - direct or indirect followup intents, we also delete them. Format: - ``projects//agent/intents/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_intent, - default_retry=self._method_configs["DeleteIntent"].retry, - default_timeout=self._method_configs["DeleteIntent"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.DeleteIntentRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_intent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def batch_update_intents( - self, - parent, - intent_batch_uri=None, - intent_batch_inline=None, - language_code=None, - update_mask=None, - intent_view=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates/Creates multiple intents in the specified agent. - - Operation - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.IntentsClient() - >>> - >>> parent = client.agent_path('[PROJECT]') - >>> - >>> response = client.batch_update_intents(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the agent to update or create intents in. - Format: ``projects//agent``. - intent_batch_uri (str): The URI to a Google Cloud Storage file containing intents to update or - create. The file format can either be a serialized proto (of IntentBatch - type) or JSON object. Note: The URI must start with "gs://". - intent_batch_inline (Union[dict, ~google.cloud.dialogflow_v2.types.IntentBatch]): The collection of intents to update or create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.IntentBatch` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - update_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.FieldMask` - intent_view (~google.cloud.dialogflow_v2.types.IntentView): Optional. The resource view to apply to the returned intent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_update_intents" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_update_intents" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_update_intents, - default_retry=self._method_configs["BatchUpdateIntents"].retry, - default_timeout=self._method_configs["BatchUpdateIntents"].timeout, - client_info=self._client_info, - ) - - # Sanity check: We have some fields which are mutually exclusive; - # raise ValueError if more than one is sent. - google.api_core.protobuf_helpers.check_oneof( - intent_batch_uri=intent_batch_uri, intent_batch_inline=intent_batch_inline - ) - - request = intent_pb2.BatchUpdateIntentsRequest( - parent=parent, - intent_batch_uri=intent_batch_uri, - intent_batch_inline=intent_batch_inline, - language_code=language_code, - update_mask=update_mask, - intent_view=intent_view, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_update_intents"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - intent_pb2.BatchUpdateIntentsResponse, - metadata_type=struct_pb2.Struct, - ) - - def batch_delete_intents( - self, - parent, - intents, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes intents in the specified agent. - - Operation - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.IntentsClient() - >>> - >>> parent = client.agent_path('[PROJECT]') - >>> - >>> # TODO: Initialize `intents`: - >>> intents = [] - >>> - >>> response = client.batch_delete_intents(parent, intents) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the agent to delete all entities types for. - Format: ``projects//agent``. - intents (list[Union[dict, ~google.cloud.dialogflow_v2.types.Intent]]): Required. The collection of intents to delete. Only intent ``name`` - must be filled in. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.Intent` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_delete_intents" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_delete_intents" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_delete_intents, - default_retry=self._method_configs["BatchDeleteIntents"].retry, - default_timeout=self._method_configs["BatchDeleteIntents"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.BatchDeleteIntentsRequest(parent=parent, intents=intents) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_delete_intents"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) diff --git a/dialogflow_v2/gapic/intents_client_config.py b/dialogflow_v2/gapic/intents_client_config.py deleted file mode 100644 index 91532198c..000000000 --- a/dialogflow_v2/gapic/intents_client_config.py +++ /dev/null @@ -1,87 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2.Intents": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListIntents": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetIntent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "CreateIntent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateIntent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteIntent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchUpdateIntents": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchDeleteIntents": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2/gapic/session_entity_types_client.py b/dialogflow_v2/gapic/session_entity_types_client.py deleted file mode 100644 index dd207c1dc..000000000 --- a/dialogflow_v2/gapic/session_entity_types_client.py +++ /dev/null @@ -1,665 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2 SessionEntityTypes API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from dialogflow_v2.gapic import enums -from dialogflow_v2.gapic import session_entity_types_client_config -from dialogflow_v2.gapic.transports import session_entity_types_grpc_transport -from dialogflow_v2.proto import agent_pb2 -from dialogflow_v2.proto import agent_pb2_grpc -from dialogflow_v2.proto import context_pb2 -from dialogflow_v2.proto import context_pb2_grpc -from dialogflow_v2.proto import entity_type_pb2 -from dialogflow_v2.proto import entity_type_pb2_grpc -from dialogflow_v2.proto import environment_pb2 -from dialogflow_v2.proto import environment_pb2_grpc -from dialogflow_v2.proto import intent_pb2 -from dialogflow_v2.proto import intent_pb2_grpc -from dialogflow_v2.proto import session_entity_type_pb2 -from dialogflow_v2.proto import session_entity_type_pb2_grpc -from dialogflow_v2.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class SessionEntityTypesClient(object): - """Service for managing ``SessionEntityTypes``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2.SessionEntityTypes" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2.SessionEntityTypesClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def session_path(cls, project, session): - """Return a fully-qualified session string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/sessions/{session}", - project=project, - session=session, - ) - - @classmethod - def session_entity_type_path(cls, project, session, entity_type): - """Return a fully-qualified session_entity_type string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}", - project=project, - session=session, - entity_type=entity_type, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.SessionEntityTypesGrpcTransport, - Callable[[~.Credentials, type], ~.SessionEntityTypesGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = session_entity_types_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=session_entity_types_grpc_transport.SessionEntityTypesGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = session_entity_types_grpc_transport.SessionEntityTypesGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_session_entity_types( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all session entity types in the specified session. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.SessionEntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # Iterate over all results - >>> for element in client.list_session_entity_types(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_session_entity_types(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The session to list all session entity types from. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users// sessions/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2.types.SessionEntityType` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_session_entity_types" not in self._inner_api_calls: - self._inner_api_calls[ - "list_session_entity_types" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_session_entity_types, - default_retry=self._method_configs["ListSessionEntityTypes"].retry, - default_timeout=self._method_configs["ListSessionEntityTypes"].timeout, - client_info=self._client_info, - ) - - request = session_entity_type_pb2.ListSessionEntityTypesRequest( - parent=parent, page_size=page_size - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_session_entity_types"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="session_entity_types", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def get_session_entity_type( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.SessionEntityTypesClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> response = client.get_session_entity_type(name) - - Args: - name (str): Required. The name of the session entity type. Format: - ``projects//agent/sessions//entityTypes/`` - or - ``projects//agent/environments//users//sessions//entityTypes/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.SessionEntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_session_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "get_session_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_session_entity_type, - default_retry=self._method_configs["GetSessionEntityType"].retry, - default_timeout=self._method_configs["GetSessionEntityType"].timeout, - client_info=self._client_info, - ) - - request = session_entity_type_pb2.GetSessionEntityTypeRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_session_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_session_entity_type( - self, - parent, - session_entity_type, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a session entity type. - - If the specified session entity type already exists, overrides the session - entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.SessionEntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `session_entity_type`: - >>> session_entity_type = {} - >>> - >>> response = client.create_session_entity_type(parent, session_entity_type) - - Args: - parent (str): Required. The session to create a session entity type for. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users// sessions/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - session_entity_type (Union[dict, ~google.cloud.dialogflow_v2.types.SessionEntityType]): Required. The session entity type to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.SessionEntityType` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.SessionEntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_session_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "create_session_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_session_entity_type, - default_retry=self._method_configs["CreateSessionEntityType"].retry, - default_timeout=self._method_configs["CreateSessionEntityType"].timeout, - client_info=self._client_info, - ) - - request = session_entity_type_pb2.CreateSessionEntityTypeRequest( - parent=parent, session_entity_type=session_entity_type - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_session_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_session_entity_type( - self, - session_entity_type, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.SessionEntityTypesClient() - >>> - >>> # TODO: Initialize `session_entity_type`: - >>> session_entity_type = {} - >>> - >>> response = client.update_session_entity_type(session_entity_type) - - Args: - session_entity_type (Union[dict, ~google.cloud.dialogflow_v2.types.SessionEntityType]): Required. The session entity type to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.SessionEntityType` - update_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.SessionEntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_session_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "update_session_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_session_entity_type, - default_retry=self._method_configs["UpdateSessionEntityType"].retry, - default_timeout=self._method_configs["UpdateSessionEntityType"].timeout, - client_info=self._client_info, - ) - - request = session_entity_type_pb2.UpdateSessionEntityTypeRequest( - session_entity_type=session_entity_type, update_mask=update_mask - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("session_entity_type.name", session_entity_type.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_session_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_session_entity_type( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.SessionEntityTypesClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> client.delete_session_entity_type(name) - - Args: - name (str): Required. The name of the entity type to delete. Format: - ``projects//agent/sessions//entityTypes/`` - or - ``projects//agent/environments//users//sessions//entityTypes/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_session_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_session_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_session_entity_type, - default_retry=self._method_configs["DeleteSessionEntityType"].retry, - default_timeout=self._method_configs["DeleteSessionEntityType"].timeout, - client_info=self._client_info, - ) - - request = session_entity_type_pb2.DeleteSessionEntityTypeRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_session_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/dialogflow_v2/gapic/session_entity_types_client_config.py b/dialogflow_v2/gapic/session_entity_types_client_config.py deleted file mode 100644 index d034682e5..000000000 --- a/dialogflow_v2/gapic/session_entity_types_client_config.py +++ /dev/null @@ -1,77 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2.SessionEntityTypes": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListSessionEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "CreateSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2/gapic/sessions_client.py b/dialogflow_v2/gapic/sessions_client.py deleted file mode 100644 index 4d75bc8af..000000000 --- a/dialogflow_v2/gapic/sessions_client.py +++ /dev/null @@ -1,413 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2 Sessions API.""" - -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.path_template -import grpc - -from dialogflow_v2.gapic import enums -from dialogflow_v2.gapic import sessions_client_config -from dialogflow_v2.gapic.transports import sessions_grpc_transport -from dialogflow_v2.proto import agent_pb2 -from dialogflow_v2.proto import agent_pb2_grpc -from dialogflow_v2.proto import audio_config_pb2 -from dialogflow_v2.proto import context_pb2 -from dialogflow_v2.proto import context_pb2_grpc -from dialogflow_v2.proto import entity_type_pb2 -from dialogflow_v2.proto import entity_type_pb2_grpc -from dialogflow_v2.proto import environment_pb2 -from dialogflow_v2.proto import environment_pb2_grpc -from dialogflow_v2.proto import intent_pb2 -from dialogflow_v2.proto import intent_pb2_grpc -from dialogflow_v2.proto import session_entity_type_pb2 -from dialogflow_v2.proto import session_entity_type_pb2_grpc -from dialogflow_v2.proto import session_pb2 -from dialogflow_v2.proto import session_pb2_grpc -from dialogflow_v2.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class SessionsClient(object): - """ - A service used for session interactions. - - For more information, see the `API interactions - guide `__. - """ - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2.Sessions" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2.SessionsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def session_path(cls, project, session): - """Return a fully-qualified session string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/sessions/{session}", - project=project, - session=session, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.SessionsGrpcTransport, - Callable[[~.Credentials, type], ~.SessionsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = sessions_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=sessions_grpc_transport.SessionsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = sessions_grpc_transport.SessionsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def detect_intent( - self, - session, - query_input, - query_params=None, - output_audio_config=None, - output_audio_config_mask=None, - input_audio=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Processes a natural language query and returns structured, actionable data - as a result. This method is not idempotent, because it may cause contexts - and session entity types to be updated, which in turn might affect - results of future queries. - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.SessionsClient() - >>> - >>> # TODO: Initialize `session`: - >>> session = '' - >>> - >>> # TODO: Initialize `query_input`: - >>> query_input = {} - >>> - >>> response = client.detect_intent(session, query_input) - - Args: - session (str): Required. The name of the session this query is sent to. Format: - ``projects//agent/sessions/``, or - ``projects//agent/environments//users//sessions/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we are using "-". It's up - to the API caller to choose an appropriate ``Session ID`` and - ``User Id``. They can be a random number or some type of user and - session identifiers (preferably hashed). The length of the - ``Session ID`` and ``User ID`` must not exceed 36 characters. - - For more information, see the `API interactions - guide `__. - query_input (Union[dict, ~google.cloud.dialogflow_v2.types.QueryInput]): Required. The input specification. It can be set to: - - 1. an audio config - which instructs the speech recognizer how to process the speech audio, - - 2. a conversational query in the form of text, or - - 3. an event that specifies which intent to trigger. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.QueryInput` - query_params (Union[dict, ~google.cloud.dialogflow_v2.types.QueryParameters]): The parameters of this query. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.QueryParameters` - output_audio_config (Union[dict, ~google.cloud.dialogflow_v2.types.OutputAudioConfig]): Instructs the speech synthesizer how to generate the output - audio. If this field is not set and agent-level speech synthesizer is not - configured, no output audio is generated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.OutputAudioConfig` - output_audio_config_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Mask for ``output_audio_config`` indicating which settings in this - request-level config should override speech synthesizer settings defined - at agent-level. - - If unspecified or empty, ``output_audio_config`` replaces the - agent-level config in its entirety. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2.types.FieldMask` - input_audio (bytes): The natural language speech audio to be processed. This field should - be populated iff ``query_input`` is set to an input audio config. A - single request can contain up to 1 minute of speech audio data. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2.types.DetectIntentResponse` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "detect_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "detect_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.detect_intent, - default_retry=self._method_configs["DetectIntent"].retry, - default_timeout=self._method_configs["DetectIntent"].timeout, - client_info=self._client_info, - ) - - request = session_pb2.DetectIntentRequest( - session=session, - query_input=query_input, - query_params=query_params, - output_audio_config=output_audio_config, - output_audio_config_mask=output_audio_config_mask, - input_audio=input_audio, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("session", session)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["detect_intent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def streaming_detect_intent( - self, - requests, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Processes a natural language query in audio format in a streaming fashion - and returns structured, actionable data as a result. This method is only - available via the gRPC API (not REST). - - Example: - >>> import dialogflow_v2 - >>> - >>> client = dialogflow_v2.SessionsClient() - >>> - >>> # TODO: Initialize `session`: - >>> session = '' - >>> - >>> # TODO: Initialize `query_input`: - >>> query_input = {} - >>> request = {'session': session, 'query_input': query_input} - >>> - >>> requests = [request] - >>> for element in client.streaming_detect_intent(requests): - ... # process element - ... pass - - Args: - requests (iterator[dict|google.cloud.dialogflow_v2.proto.session_pb2.StreamingDetectIntentRequest]): The input objects. If a dict is provided, it must be of the - same form as the protobuf message :class:`~google.cloud.dialogflow_v2.types.StreamingDetectIntentRequest` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - Iterable[~google.cloud.dialogflow_v2.types.StreamingDetectIntentResponse]. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "streaming_detect_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "streaming_detect_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.streaming_detect_intent, - default_retry=self._method_configs["StreamingDetectIntent"].retry, - default_timeout=self._method_configs["StreamingDetectIntent"].timeout, - client_info=self._client_info, - ) - - return self._inner_api_calls["streaming_detect_intent"]( - requests, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/dialogflow_v2/gapic/sessions_client_config.py b/dialogflow_v2/gapic/sessions_client_config.py deleted file mode 100644 index 23bcd56dd..000000000 --- a/dialogflow_v2/gapic/sessions_client_config.py +++ /dev/null @@ -1,62 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2.Sessions": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "DetectIntent": { - "timeout_millis": 220000, - "retry_codes_name": "retry_policy_2_codes", - "retry_params_name": "retry_policy_2_params", - }, - "StreamingDetectIntent": { - "timeout_millis": 220000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2/gapic/transports/__init__.py b/dialogflow_v2/gapic/transports/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/dialogflow_v2/gapic/transports/agents_grpc_transport.py b/dialogflow_v2/gapic/transports/agents_grpc_transport.py deleted file mode 100644 index 51018751f..000000000 --- a/dialogflow_v2/gapic/transports/agents_grpc_transport.py +++ /dev/null @@ -1,268 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers -import google.api_core.operations_v1 - -from dialogflow_v2.proto import agent_pb2_grpc - - -class AgentsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2 Agents API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = {"agents_stub": agent_pb2_grpc.AgentsStub(channel)} - - # Because this API includes a method that returns a - # long-running operation (proto: google.longrunning.Operation), - # instantiate an LRO client. - self._operations_client = google.api_core.operations_v1.OperationsClient( - channel - ) - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def get_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.get_agent`. - - Retrieves the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].GetAgent - - @property - def set_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.set_agent`. - - Creates/updates the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].SetAgent - - @property - def delete_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.delete_agent`. - - Deletes the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].DeleteAgent - - @property - def search_agents(self): - """Return the gRPC stub for :meth:`AgentsClient.search_agents`. - - Returns the list of agents. - - Since there is at most one conversational agent per project, this method - is useful primarily for listing all agents across projects the caller - has access to. One can achieve that with a wildcard project collection - id "-". Refer to `List - Sub-Collections `__. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].SearchAgents - - @property - def train_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.train_agent`. - - Trains the specified agent. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].TrainAgent - - @property - def export_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.export_agent`. - - Exports the specified agent to a ZIP file. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].ExportAgent - - @property - def import_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.import_agent`. - - Imports the specified agent from a ZIP file. - - Uploads new intents and entity types without deleting the existing ones. - Intents and entity types with the same name are replaced with the new - versions from ``ImportAgentRequest``. After the import, the imported - draft agent will be trained automatically (unless disabled in agent - settings). However, once the import is done, training may not be - completed yet. Please call ``TrainAgent`` and wait for the operation it - returns in order to train explicitly. - - Operation An operation which - tracks when importing is complete. It only tracks when the draft agent - is updated not when it is done training. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].ImportAgent - - @property - def restore_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.restore_agent`. - - Restores the specified agent from a ZIP file. - - Replaces the current agent version with a new one. All the intents and - entity types in the older version are deleted. After the restore, the - restored draft agent will be trained automatically (unless disabled in - agent settings). However, once the restore is done, training may not be - completed yet. Please call ``TrainAgent`` and wait for the operation it - returns in order to train explicitly. - - Operation An operation which - tracks when restoring is complete. It only tracks when the draft agent - is updated not when it is done training. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].RestoreAgent - - @property - def get_validation_result(self): - """Return the gRPC stub for :meth:`AgentsClient.get_validation_result`. - - Gets agent validation result. Agent validation is performed during - training time and is updated automatically when training is completed. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].GetValidationResult diff --git a/dialogflow_v2/gapic/transports/contexts_grpc_transport.py b/dialogflow_v2/gapic/transports/contexts_grpc_transport.py deleted file mode 100644 index f85c8918d..000000000 --- a/dialogflow_v2/gapic/transports/contexts_grpc_transport.py +++ /dev/null @@ -1,189 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from dialogflow_v2.proto import context_pb2_grpc - - -class ContextsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2 Contexts API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = {"contexts_stub": context_pb2_grpc.ContextsStub(channel)} - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_contexts(self): - """Return the gRPC stub for :meth:`ContextsClient.list_contexts`. - - Returns the list of all contexts in the specified session. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].ListContexts - - @property - def get_context(self): - """Return the gRPC stub for :meth:`ContextsClient.get_context`. - - Retrieves the specified context. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].GetContext - - @property - def create_context(self): - """Return the gRPC stub for :meth:`ContextsClient.create_context`. - - Creates a context. - - If the specified context already exists, overrides the context. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].CreateContext - - @property - def update_context(self): - """Return the gRPC stub for :meth:`ContextsClient.update_context`. - - Updates the specified context. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].UpdateContext - - @property - def delete_context(self): - """Return the gRPC stub for :meth:`ContextsClient.delete_context`. - - Deletes the specified context. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].DeleteContext - - @property - def delete_all_contexts(self): - """Return the gRPC stub for :meth:`ContextsClient.delete_all_contexts`. - - Deletes all active contexts in the specified session. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].DeleteAllContexts diff --git a/dialogflow_v2/gapic/transports/entity_types_grpc_transport.py b/dialogflow_v2/gapic/transports/entity_types_grpc_transport.py deleted file mode 100644 index a60504564..000000000 --- a/dialogflow_v2/gapic/transports/entity_types_grpc_transport.py +++ /dev/null @@ -1,261 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers -import google.api_core.operations_v1 - -from dialogflow_v2.proto import entity_type_pb2_grpc - - -class EntityTypesGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2 EntityTypes API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "entity_types_stub": entity_type_pb2_grpc.EntityTypesStub(channel) - } - - # Because this API includes a method that returns a - # long-running operation (proto: google.longrunning.Operation), - # instantiate an LRO client. - self._operations_client = google.api_core.operations_v1.OperationsClient( - channel - ) - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_entity_types(self): - """Return the gRPC stub for :meth:`EntityTypesClient.list_entity_types`. - - Returns the list of all entity types in the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].ListEntityTypes - - @property - def get_entity_type(self): - """Return the gRPC stub for :meth:`EntityTypesClient.get_entity_type`. - - Retrieves the specified entity type. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].GetEntityType - - @property - def create_entity_type(self): - """Return the gRPC stub for :meth:`EntityTypesClient.create_entity_type`. - - Creates an entity type in the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].CreateEntityType - - @property - def update_entity_type(self): - """Return the gRPC stub for :meth:`EntityTypesClient.update_entity_type`. - - Updates the specified entity type. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].UpdateEntityType - - @property - def delete_entity_type(self): - """Return the gRPC stub for :meth:`EntityTypesClient.delete_entity_type`. - - Deletes the specified entity type. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].DeleteEntityType - - @property - def batch_update_entity_types(self): - """Return the gRPC stub for :meth:`EntityTypesClient.batch_update_entity_types`. - - Updates/Creates multiple entity types in the specified agent. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].BatchUpdateEntityTypes - - @property - def batch_delete_entity_types(self): - """Return the gRPC stub for :meth:`EntityTypesClient.batch_delete_entity_types`. - - Deletes entity types in the specified agent. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].BatchDeleteEntityTypes - - @property - def batch_create_entities(self): - """Return the gRPC stub for :meth:`EntityTypesClient.batch_create_entities`. - - Creates multiple new entities in the specified entity type. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].BatchCreateEntities - - @property - def batch_update_entities(self): - """Return the gRPC stub for :meth:`EntityTypesClient.batch_update_entities`. - - Updates or creates multiple entities in the specified entity type. - This method does not affect entities in the entity type that aren't - explicitly specified in the request. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].BatchUpdateEntities - - @property - def batch_delete_entities(self): - """Return the gRPC stub for :meth:`EntityTypesClient.batch_delete_entities`. - - Deletes entities in the specified entity type. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].BatchDeleteEntities diff --git a/dialogflow_v2/gapic/transports/environments_grpc_transport.py b/dialogflow_v2/gapic/transports/environments_grpc_transport.py deleted file mode 100644 index e9ea3719b..000000000 --- a/dialogflow_v2/gapic/transports/environments_grpc_transport.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from dialogflow_v2.proto import environment_pb2_grpc - - -class EnvironmentsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2 Environments API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "environments_stub": environment_pb2_grpc.EnvironmentsStub(channel) - } - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_environments(self): - """Return the gRPC stub for :meth:`EnvironmentsClient.list_environments`. - - Returns the list of all non-draft environments of the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["environments_stub"].ListEnvironments diff --git a/dialogflow_v2/gapic/transports/intents_grpc_transport.py b/dialogflow_v2/gapic/transports/intents_grpc_transport.py deleted file mode 100644 index 520c66ff8..000000000 --- a/dialogflow_v2/gapic/transports/intents_grpc_transport.py +++ /dev/null @@ -1,212 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers -import google.api_core.operations_v1 - -from dialogflow_v2.proto import intent_pb2_grpc - - -class IntentsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2 Intents API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = {"intents_stub": intent_pb2_grpc.IntentsStub(channel)} - - # Because this API includes a method that returns a - # long-running operation (proto: google.longrunning.Operation), - # instantiate an LRO client. - self._operations_client = google.api_core.operations_v1.OperationsClient( - channel - ) - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_intents(self): - """Return the gRPC stub for :meth:`IntentsClient.list_intents`. - - Returns the list of all intents in the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].ListIntents - - @property - def get_intent(self): - """Return the gRPC stub for :meth:`IntentsClient.get_intent`. - - Retrieves the specified intent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].GetIntent - - @property - def create_intent(self): - """Return the gRPC stub for :meth:`IntentsClient.create_intent`. - - Creates an intent in the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].CreateIntent - - @property - def update_intent(self): - """Return the gRPC stub for :meth:`IntentsClient.update_intent`. - - Updates the specified intent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].UpdateIntent - - @property - def delete_intent(self): - """Return the gRPC stub for :meth:`IntentsClient.delete_intent`. - - Deletes the specified intent and its direct or indirect followup intents. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].DeleteIntent - - @property - def batch_update_intents(self): - """Return the gRPC stub for :meth:`IntentsClient.batch_update_intents`. - - Updates/Creates multiple intents in the specified agent. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].BatchUpdateIntents - - @property - def batch_delete_intents(self): - """Return the gRPC stub for :meth:`IntentsClient.batch_delete_intents`. - - Deletes intents in the specified agent. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].BatchDeleteIntents diff --git a/dialogflow_v2/gapic/transports/session_entity_types_grpc_transport.py b/dialogflow_v2/gapic/transports/session_entity_types_grpc_transport.py deleted file mode 100644 index ab03ff5ea..000000000 --- a/dialogflow_v2/gapic/transports/session_entity_types_grpc_transport.py +++ /dev/null @@ -1,201 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from dialogflow_v2.proto import session_entity_type_pb2_grpc - - -class SessionEntityTypesGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2 SessionEntityTypes API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "session_entity_types_stub": session_entity_type_pb2_grpc.SessionEntityTypesStub( - channel - ) - } - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_session_entity_types(self): - """Return the gRPC stub for :meth:`SessionEntityTypesClient.list_session_entity_types`. - - Returns the list of all session entity types in the specified session. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["session_entity_types_stub"].ListSessionEntityTypes - - @property - def get_session_entity_type(self): - """Return the gRPC stub for :meth:`SessionEntityTypesClient.get_session_entity_type`. - - Retrieves the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["session_entity_types_stub"].GetSessionEntityType - - @property - def create_session_entity_type(self): - """Return the gRPC stub for :meth:`SessionEntityTypesClient.create_session_entity_type`. - - Creates a session entity type. - - If the specified session entity type already exists, overrides the session - entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["session_entity_types_stub"].CreateSessionEntityType - - @property - def update_session_entity_type(self): - """Return the gRPC stub for :meth:`SessionEntityTypesClient.update_session_entity_type`. - - Updates the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["session_entity_types_stub"].UpdateSessionEntityType - - @property - def delete_session_entity_type(self): - """Return the gRPC stub for :meth:`SessionEntityTypesClient.delete_session_entity_type`. - - Deletes the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["session_entity_types_stub"].DeleteSessionEntityType diff --git a/dialogflow_v2/gapic/transports/sessions_grpc_transport.py b/dialogflow_v2/gapic/transports/sessions_grpc_transport.py deleted file mode 100644 index fa9773ddb..000000000 --- a/dialogflow_v2/gapic/transports/sessions_grpc_transport.py +++ /dev/null @@ -1,140 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from dialogflow_v2.proto import session_pb2_grpc - - -class SessionsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2 Sessions API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = {"sessions_stub": session_pb2_grpc.SessionsStub(channel)} - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def detect_intent(self): - """Return the gRPC stub for :meth:`SessionsClient.detect_intent`. - - Processes a natural language query and returns structured, actionable data - as a result. This method is not idempotent, because it may cause contexts - and session entity types to be updated, which in turn might affect - results of future queries. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["sessions_stub"].DetectIntent - - @property - def streaming_detect_intent(self): - """Return the gRPC stub for :meth:`SessionsClient.streaming_detect_intent`. - - Processes a natural language query in audio format in a streaming fashion - and returns structured, actionable data as a result. This method is only - available via the gRPC API (not REST). - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["sessions_stub"].StreamingDetectIntent diff --git a/dialogflow_v2/proto/__init__.py b/dialogflow_v2/proto/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/dialogflow_v2/proto/agent_pb2.py b/dialogflow_v2/proto/agent_pb2.py deleted file mode 100644 index 0fe9c9f82..000000000 --- a/dialogflow_v2/proto/agent_pb2.py +++ /dev/null @@ -1,1640 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2/proto/agent.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from dialogflow_v2.proto import ( - validation_result_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_validation__result__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2/proto/agent.proto", - package="google.cloud.dialogflow.v2", - syntax="proto3", - serialized_options=b"\n\036com.google.cloud.dialogflow.v2B\nAgentProtoP\001ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cloud.Dialogflow.V2", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n,google/cloud/dialogflow_v2/proto/agent.proto\x12\x1agoogle.cloud.dialogflow.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x38google/cloud/dialogflow_v2/proto/validation_result.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\xf0\x06\n\x05\x41gent\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12"\n\x15\x64\x65\x66\x61ult_language_code\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12%\n\x18supported_language_codes\x18\x04 \x03(\tB\x03\xe0\x41\x01\x12\x16\n\ttime_zone\x18\x05 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x0b\x64\x65scription\x18\x06 \x01(\tB\x03\xe0\x41\x01\x12\x17\n\navatar_uri\x18\x07 \x01(\tB\x03\xe0\x41\x01\x12\x1b\n\x0e\x65nable_logging\x18\x08 \x01(\x08\x42\x03\xe0\x41\x01\x12\x44\n\nmatch_mode\x18\t \x01(\x0e\x32+.google.cloud.dialogflow.v2.Agent.MatchModeB\x03\xe0\x41\x01\x12%\n\x18\x63lassification_threshold\x18\n \x01(\x02\x42\x03\xe0\x41\x01\x12\x46\n\x0b\x61pi_version\x18\x0e \x01(\x0e\x32,.google.cloud.dialogflow.v2.Agent.ApiVersionB\x03\xe0\x41\x01\x12\x39\n\x04tier\x18\x0f \x01(\x0e\x32&.google.cloud.dialogflow.v2.Agent.TierB\x03\xe0\x41\x01"V\n\tMatchMode\x12\x1a\n\x16MATCH_MODE_UNSPECIFIED\x10\x00\x12\x15\n\x11MATCH_MODE_HYBRID\x10\x01\x12\x16\n\x12MATCH_MODE_ML_ONLY\x10\x02"l\n\nApiVersion\x12\x1b\n\x17\x41PI_VERSION_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x41PI_VERSION_V1\x10\x01\x12\x12\n\x0e\x41PI_VERSION_V2\x10\x02\x12\x19\n\x15\x41PI_VERSION_V2_BETA_1\x10\x03"^\n\x04Tier\x12\x14\n\x10TIER_UNSPECIFIED\x10\x00\x12\x11\n\rTIER_STANDARD\x10\x01\x12\x13\n\x0fTIER_ENTERPRISE\x10\x02\x12\x18\n\x14TIER_ENTERPRISE_PLUS\x10\x03:>\xea\x41;\n\x1f\x64ialogflow.googleapis.com/Agent\x12\x18projects/{project}/agent"J\n\x0fGetAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent"~\n\x0fSetAgentRequest\x12\x35\n\x05\x61gent\x18\x01 \x01(\x0b\x32!.google.cloud.dialogflow.v2.AgentB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01"M\n\x12\x44\x65leteAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent"z\n\x13SearchAgentsRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x12\n\npage_token\x18\x03 \x01(\t"b\n\x14SearchAgentsResponse\x12\x31\n\x06\x61gents\x18\x01 \x03(\x0b\x32!.google.cloud.dialogflow.v2.Agent\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"L\n\x11TrainAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent"e\n\x12\x45xportAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent\x12\x16\n\tagent_uri\x18\x02 \x01(\tB\x03\xe0\x41\x02"L\n\x13\x45xportAgentResponse\x12\x13\n\tagent_uri\x18\x01 \x01(\tH\x00\x12\x17\n\ragent_content\x18\x02 \x01(\x0cH\x00\x42\x07\n\x05\x61gent"\x84\x01\n\x12ImportAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent\x12\x13\n\tagent_uri\x18\x02 \x01(\tH\x00\x12\x17\n\ragent_content\x18\x03 \x01(\x0cH\x00\x42\x07\n\x05\x61gent"\x85\x01\n\x13RestoreAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent\x12\x13\n\tagent_uri\x18\x02 \x01(\tH\x00\x12\x17\n\ragent_content\x18\x03 \x01(\x0cH\x00\x42\x07\n\x05\x61gent"q\n\x1aGetValidationResultRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01\x32\xc5\r\n\x06\x41gents\x12\x8a\x01\n\x08GetAgent\x12+.google.cloud.dialogflow.v2.GetAgentRequest\x1a!.google.cloud.dialogflow.v2.Agent".\x82\xd3\xe4\x93\x02\x1f\x12\x1d/v2/{parent=projects/*}/agent\xda\x41\x06parent\x12\x96\x01\n\x08SetAgent\x12+.google.cloud.dialogflow.v2.SetAgentRequest\x1a!.google.cloud.dialogflow.v2.Agent":\x82\xd3\xe4\x93\x02,"#/v2/{agent.parent=projects/*}/agent:\x05\x61gent\xda\x41\x05\x61gent\x12\x85\x01\n\x0b\x44\x65leteAgent\x12..google.cloud.dialogflow.v2.DeleteAgentRequest\x1a\x16.google.protobuf.Empty".\x82\xd3\xe4\x93\x02\x1f*\x1d/v2/{parent=projects/*}/agent\xda\x41\x06parent\x12\xa8\x01\n\x0cSearchAgents\x12/.google.cloud.dialogflow.v2.SearchAgentsRequest\x1a\x30.google.cloud.dialogflow.v2.SearchAgentsResponse"5\x82\xd3\xe4\x93\x02&\x12$/v2/{parent=projects/*}/agent:search\xda\x41\x06parent\x12\xc5\x01\n\nTrainAgent\x12-.google.cloud.dialogflow.v2.TrainAgentRequest\x1a\x1d.google.longrunning.Operation"i\x82\xd3\xe4\x93\x02("#/v2/{parent=projects/*}/agent:train:\x01*\xda\x41\x06parent\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\xe2\x01\n\x0b\x45xportAgent\x12..google.cloud.dialogflow.v2.ExportAgentRequest\x1a\x1d.google.longrunning.Operation"\x83\x01\x82\xd3\xe4\x93\x02)"$/v2/{parent=projects/*}/agent:export:\x01*\xda\x41\x06parent\xca\x41H\n.google.cloud.dialogflow.v2.ExportAgentResponse\x12\x16google.protobuf.Struct\x12\xbf\x01\n\x0bImportAgent\x12..google.cloud.dialogflow.v2.ImportAgentRequest\x1a\x1d.google.longrunning.Operation"a\x82\xd3\xe4\x93\x02)"$/v2/{parent=projects/*}/agent:import:\x01*\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\xc2\x01\n\x0cRestoreAgent\x12/.google.cloud.dialogflow.v2.RestoreAgentRequest\x1a\x1d.google.longrunning.Operation"b\x82\xd3\xe4\x93\x02*"%/v2/{parent=projects/*}/agent:restore:\x01*\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\xb3\x01\n\x13GetValidationResult\x12\x36.google.cloud.dialogflow.v2.GetValidationResultRequest\x1a,.google.cloud.dialogflow.v2.ValidationResult"6\x82\xd3\xe4\x93\x02\x30\x12./v2/{parent=projects/*}/agent/validationResult\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\x99\x01\n\x1e\x63om.google.cloud.dialogflow.v2B\nAgentProtoP\x01ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1aGoogle.Cloud.Dialogflow.V2b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_validation__result__pb2.DESCRIPTOR, - google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - ], -) - - -_AGENT_MATCHMODE = _descriptor.EnumDescriptor( - name="MatchMode", - full_name="google.cloud.dialogflow.v2.Agent.MatchMode", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="MATCH_MODE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MATCH_MODE_HYBRID", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MATCH_MODE_ML_ONLY", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=874, - serialized_end=960, -) -_sym_db.RegisterEnumDescriptor(_AGENT_MATCHMODE) - -_AGENT_APIVERSION = _descriptor.EnumDescriptor( - name="ApiVersion", - full_name="google.cloud.dialogflow.v2.Agent.ApiVersion", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="API_VERSION_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="API_VERSION_V1", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="API_VERSION_V2", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="API_VERSION_V2_BETA_1", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=962, - serialized_end=1070, -) -_sym_db.RegisterEnumDescriptor(_AGENT_APIVERSION) - -_AGENT_TIER = _descriptor.EnumDescriptor( - name="Tier", - full_name="google.cloud.dialogflow.v2.Agent.Tier", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="TIER_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TIER_STANDARD", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TIER_ENTERPRISE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TIER_ENTERPRISE_PLUS", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1072, - serialized_end=1166, -) -_sym_db.RegisterEnumDescriptor(_AGENT_TIER) - - -_AGENT = _descriptor.Descriptor( - name="Agent", - full_name="google.cloud.dialogflow.v2.Agent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.Agent.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.dialogflow.v2.Agent.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="default_language_code", - full_name="google.cloud.dialogflow.v2.Agent.default_language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="supported_language_codes", - full_name="google.cloud.dialogflow.v2.Agent.supported_language_codes", - index=3, - number=4, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="time_zone", - full_name="google.cloud.dialogflow.v2.Agent.time_zone", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2.Agent.description", - index=5, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="avatar_uri", - full_name="google.cloud.dialogflow.v2.Agent.avatar_uri", - index=6, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="enable_logging", - full_name="google.cloud.dialogflow.v2.Agent.enable_logging", - index=7, - number=8, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="match_mode", - full_name="google.cloud.dialogflow.v2.Agent.match_mode", - index=8, - number=9, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="classification_threshold", - full_name="google.cloud.dialogflow.v2.Agent.classification_threshold", - index=9, - number=10, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="api_version", - full_name="google.cloud.dialogflow.v2.Agent.api_version", - index=10, - number=14, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="tier", - full_name="google.cloud.dialogflow.v2.Agent.tier", - index=11, - number=15, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_AGENT_MATCHMODE, _AGENT_APIVERSION, _AGENT_TIER], - serialized_options=b"\352A;\n\037dialogflow.googleapis.com/Agent\022\030projects/{project}/agent", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=350, - serialized_end=1230, -) - - -_GETAGENTREQUEST = _descriptor.Descriptor( - name="GetAgentRequest", - full_name="google.cloud.dialogflow.v2.GetAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.GetAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1232, - serialized_end=1306, -) - - -_SETAGENTREQUEST = _descriptor.Descriptor( - name="SetAgentRequest", - full_name="google.cloud.dialogflow.v2.SetAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="agent", - full_name="google.cloud.dialogflow.v2.SetAgentRequest.agent", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2.SetAgentRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1308, - serialized_end=1434, -) - - -_DELETEAGENTREQUEST = _descriptor.Descriptor( - name="DeleteAgentRequest", - full_name="google.cloud.dialogflow.v2.DeleteAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.DeleteAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1436, - serialized_end=1513, -) - - -_SEARCHAGENTSREQUEST = _descriptor.Descriptor( - name="SearchAgentsRequest", - full_name="google.cloud.dialogflow.v2.SearchAgentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.SearchAgentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2.SearchAgentsRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2.SearchAgentsRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1515, - serialized_end=1637, -) - - -_SEARCHAGENTSRESPONSE = _descriptor.Descriptor( - name="SearchAgentsResponse", - full_name="google.cloud.dialogflow.v2.SearchAgentsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="agents", - full_name="google.cloud.dialogflow.v2.SearchAgentsResponse.agents", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2.SearchAgentsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1639, - serialized_end=1737, -) - - -_TRAINAGENTREQUEST = _descriptor.Descriptor( - name="TrainAgentRequest", - full_name="google.cloud.dialogflow.v2.TrainAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.TrainAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1739, - serialized_end=1815, -) - - -_EXPORTAGENTREQUEST = _descriptor.Descriptor( - name="ExportAgentRequest", - full_name="google.cloud.dialogflow.v2.ExportAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.ExportAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_uri", - full_name="google.cloud.dialogflow.v2.ExportAgentRequest.agent_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1817, - serialized_end=1918, -) - - -_EXPORTAGENTRESPONSE = _descriptor.Descriptor( - name="ExportAgentResponse", - full_name="google.cloud.dialogflow.v2.ExportAgentResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="agent_uri", - full_name="google.cloud.dialogflow.v2.ExportAgentResponse.agent_uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_content", - full_name="google.cloud.dialogflow.v2.ExportAgentResponse.agent_content", - index=1, - number=2, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="agent", - full_name="google.cloud.dialogflow.v2.ExportAgentResponse.agent", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=1920, - serialized_end=1996, -) - - -_IMPORTAGENTREQUEST = _descriptor.Descriptor( - name="ImportAgentRequest", - full_name="google.cloud.dialogflow.v2.ImportAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.ImportAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_uri", - full_name="google.cloud.dialogflow.v2.ImportAgentRequest.agent_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_content", - full_name="google.cloud.dialogflow.v2.ImportAgentRequest.agent_content", - index=2, - number=3, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="agent", - full_name="google.cloud.dialogflow.v2.ImportAgentRequest.agent", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=1999, - serialized_end=2131, -) - - -_RESTOREAGENTREQUEST = _descriptor.Descriptor( - name="RestoreAgentRequest", - full_name="google.cloud.dialogflow.v2.RestoreAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.RestoreAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_uri", - full_name="google.cloud.dialogflow.v2.RestoreAgentRequest.agent_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_content", - full_name="google.cloud.dialogflow.v2.RestoreAgentRequest.agent_content", - index=2, - number=3, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="agent", - full_name="google.cloud.dialogflow.v2.RestoreAgentRequest.agent", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=2134, - serialized_end=2267, -) - - -_GETVALIDATIONRESULTREQUEST = _descriptor.Descriptor( - name="GetValidationResultRequest", - full_name="google.cloud.dialogflow.v2.GetValidationResultRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.GetValidationResultRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.GetValidationResultRequest.language_code", - index=1, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2269, - serialized_end=2382, -) - -_AGENT.fields_by_name["match_mode"].enum_type = _AGENT_MATCHMODE -_AGENT.fields_by_name["api_version"].enum_type = _AGENT_APIVERSION -_AGENT.fields_by_name["tier"].enum_type = _AGENT_TIER -_AGENT_MATCHMODE.containing_type = _AGENT -_AGENT_APIVERSION.containing_type = _AGENT -_AGENT_TIER.containing_type = _AGENT -_SETAGENTREQUEST.fields_by_name["agent"].message_type = _AGENT -_SETAGENTREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_SEARCHAGENTSRESPONSE.fields_by_name["agents"].message_type = _AGENT -_EXPORTAGENTRESPONSE.oneofs_by_name["agent"].fields.append( - _EXPORTAGENTRESPONSE.fields_by_name["agent_uri"] -) -_EXPORTAGENTRESPONSE.fields_by_name[ - "agent_uri" -].containing_oneof = _EXPORTAGENTRESPONSE.oneofs_by_name["agent"] -_EXPORTAGENTRESPONSE.oneofs_by_name["agent"].fields.append( - _EXPORTAGENTRESPONSE.fields_by_name["agent_content"] -) -_EXPORTAGENTRESPONSE.fields_by_name[ - "agent_content" -].containing_oneof = _EXPORTAGENTRESPONSE.oneofs_by_name["agent"] -_IMPORTAGENTREQUEST.oneofs_by_name["agent"].fields.append( - _IMPORTAGENTREQUEST.fields_by_name["agent_uri"] -) -_IMPORTAGENTREQUEST.fields_by_name[ - "agent_uri" -].containing_oneof = _IMPORTAGENTREQUEST.oneofs_by_name["agent"] -_IMPORTAGENTREQUEST.oneofs_by_name["agent"].fields.append( - _IMPORTAGENTREQUEST.fields_by_name["agent_content"] -) -_IMPORTAGENTREQUEST.fields_by_name[ - "agent_content" -].containing_oneof = _IMPORTAGENTREQUEST.oneofs_by_name["agent"] -_RESTOREAGENTREQUEST.oneofs_by_name["agent"].fields.append( - _RESTOREAGENTREQUEST.fields_by_name["agent_uri"] -) -_RESTOREAGENTREQUEST.fields_by_name[ - "agent_uri" -].containing_oneof = _RESTOREAGENTREQUEST.oneofs_by_name["agent"] -_RESTOREAGENTREQUEST.oneofs_by_name["agent"].fields.append( - _RESTOREAGENTREQUEST.fields_by_name["agent_content"] -) -_RESTOREAGENTREQUEST.fields_by_name[ - "agent_content" -].containing_oneof = _RESTOREAGENTREQUEST.oneofs_by_name["agent"] -DESCRIPTOR.message_types_by_name["Agent"] = _AGENT -DESCRIPTOR.message_types_by_name["GetAgentRequest"] = _GETAGENTREQUEST -DESCRIPTOR.message_types_by_name["SetAgentRequest"] = _SETAGENTREQUEST -DESCRIPTOR.message_types_by_name["DeleteAgentRequest"] = _DELETEAGENTREQUEST -DESCRIPTOR.message_types_by_name["SearchAgentsRequest"] = _SEARCHAGENTSREQUEST -DESCRIPTOR.message_types_by_name["SearchAgentsResponse"] = _SEARCHAGENTSRESPONSE -DESCRIPTOR.message_types_by_name["TrainAgentRequest"] = _TRAINAGENTREQUEST -DESCRIPTOR.message_types_by_name["ExportAgentRequest"] = _EXPORTAGENTREQUEST -DESCRIPTOR.message_types_by_name["ExportAgentResponse"] = _EXPORTAGENTRESPONSE -DESCRIPTOR.message_types_by_name["ImportAgentRequest"] = _IMPORTAGENTREQUEST -DESCRIPTOR.message_types_by_name["RestoreAgentRequest"] = _RESTOREAGENTREQUEST -DESCRIPTOR.message_types_by_name[ - "GetValidationResultRequest" -] = _GETVALIDATIONRESULTREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Agent = _reflection.GeneratedProtocolMessageType( - "Agent", - (_message.Message,), - { - "DESCRIPTOR": _AGENT, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """A Dialogflow agent is a virtual agent that handles conversations with - your end-users. It is a natural language understanding module that - understands the nuances of human language. Dialogflow translates end- - user text or audio during a conversation to structured data that your - apps and services can understand. You design and build a Dialogflow - agent to handle the types of conversations required for your system. - For more information about agents, see the `Agent guide - `__. - - Attributes: - parent: - Required. The project of this agent. Format: - ``projects/``. - display_name: - Required. The name of this agent. - default_language_code: - Required. The default language of the agent as a language tag. - See `Language Support `__ for a list of the currently supported - language codes. This field cannot be set by the ``Update`` - method. - supported_language_codes: - Optional. The list of all languages supported by this agent - (except for the ``default_language_code``). - time_zone: - Required. The time zone of this agent from the `time zone - database `__, e.g., - America/New_York, Europe/Paris. - description: - Optional. The description of this agent. The maximum length is - 500 characters. If exceeded, the request is rejected. - avatar_uri: - Optional. The URI of the agent’s avatar. Avatars are used - throughout the Dialogflow console and in the self-hosted `Web - Demo - `__ integration. - enable_logging: - Optional. Determines whether this agent should log - conversation queries. - match_mode: - Optional. Determines how intents are detected from user - queries. - classification_threshold: - Optional. To filter out false positive results and still get - variety in matched natural language inputs for your agent, you - can tune the machine learning classification threshold. If the - returned score value is less than the threshold value, then a - fallback intent will be triggered or, if there are no fallback - intents defined, no intent will be triggered. The score values - range from 0.0 (completely uncertain) to 1.0 (completely - certain). If set to 0.0, the default of 0.3 is used. - api_version: - Optional. API version displayed in Dialogflow console. If not - specified, V2 API is assumed. Clients are free to query - different service endpoints for different API versions. - However, bots connectors and webhook calls will follow the - specified API version. - tier: - Optional. The agent tier. If not specified, TIER_STANDARD is - assumed. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Agent) - }, -) -_sym_db.RegisterMessage(Agent) - -GetAgentRequest = _reflection.GeneratedProtocolMessageType( - "GetAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The request message for - [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent]. - - Attributes: - parent: - Required. The project that the agent to fetch is associated - with. Format: ``projects/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.GetAgentRequest) - }, -) -_sym_db.RegisterMessage(GetAgentRequest) - -SetAgentRequest = _reflection.GeneratedProtocolMessageType( - "SetAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _SETAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The request message for - [Agents.SetAgent][google.cloud.dialogflow.v2.Agents.SetAgent]. - - Attributes: - agent: - Required. The agent to update. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.SetAgentRequest) - }, -) -_sym_db.RegisterMessage(SetAgentRequest) - -DeleteAgentRequest = _reflection.GeneratedProtocolMessageType( - "DeleteAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The request message for - [Agents.DeleteAgent][google.cloud.dialogflow.v2.Agents.DeleteAgent]. - - Attributes: - parent: - Required. The project that the agent to delete is associated - with. Format: ``projects/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.DeleteAgentRequest) - }, -) -_sym_db.RegisterMessage(DeleteAgentRequest) - -SearchAgentsRequest = _reflection.GeneratedProtocolMessageType( - "SearchAgentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _SEARCHAGENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The request message for - [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. - - Attributes: - parent: - Required. The project to list agents from. Format: - ``projects/``. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - The next_page_token value returned from a previous list - request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.SearchAgentsRequest) - }, -) -_sym_db.RegisterMessage(SearchAgentsRequest) - -SearchAgentsResponse = _reflection.GeneratedProtocolMessageType( - "SearchAgentsResponse", - (_message.Message,), - { - "DESCRIPTOR": _SEARCHAGENTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The response message for - [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. - - Attributes: - agents: - The list of agents. There will be a maximum number of items - returned based on the page_size field in the request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.SearchAgentsResponse) - }, -) -_sym_db.RegisterMessage(SearchAgentsResponse) - -TrainAgentRequest = _reflection.GeneratedProtocolMessageType( - "TrainAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _TRAINAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The request message for - [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent]. - - Attributes: - parent: - Required. The project that the agent to train is associated - with. Format: ``projects/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.TrainAgentRequest) - }, -) -_sym_db.RegisterMessage(TrainAgentRequest) - -ExportAgentRequest = _reflection.GeneratedProtocolMessageType( - "ExportAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _EXPORTAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The request message for - [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. - - Attributes: - parent: - Required. The project that the agent to export is associated - with. Format: ``projects/``. - agent_uri: - Required. The `Google Cloud Storage - `__ URI to export the - agent to. The format of this URI must be ``gs:///``. If left unspecified, the serialized - agent is returned inline. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ExportAgentRequest) - }, -) -_sym_db.RegisterMessage(ExportAgentRequest) - -ExportAgentResponse = _reflection.GeneratedProtocolMessageType( - "ExportAgentResponse", - (_message.Message,), - { - "DESCRIPTOR": _EXPORTAGENTRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The response message for - [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. - - Attributes: - agent: - The exported agent. - agent_uri: - The URI to a file containing the exported agent. This field is - populated only if ``agent_uri`` is specified in - ``ExportAgentRequest``. - agent_content: - Zip compressed raw byte content for agent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ExportAgentResponse) - }, -) -_sym_db.RegisterMessage(ExportAgentResponse) - -ImportAgentRequest = _reflection.GeneratedProtocolMessageType( - "ImportAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _IMPORTAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The request message for - [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent]. - - Attributes: - parent: - Required. The project that the agent to import is associated - with. Format: ``projects/``. - agent: - Required. The agent to import. - agent_uri: - The URI to a Google Cloud Storage file containing the agent to - import. Note: The URI must start with “gs://”. - agent_content: - Zip compressed raw byte content for agent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ImportAgentRequest) - }, -) -_sym_db.RegisterMessage(ImportAgentRequest) - -RestoreAgentRequest = _reflection.GeneratedProtocolMessageType( - "RestoreAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _RESTOREAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The request message for - [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent]. - - Attributes: - parent: - Required. The project that the agent to restore is associated - with. Format: ``projects/``. - agent: - Required. The agent to restore. - agent_uri: - The URI to a Google Cloud Storage file containing the agent to - restore. Note: The URI must start with “gs://”. - agent_content: - Zip compressed raw byte content for agent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.RestoreAgentRequest) - }, -) -_sym_db.RegisterMessage(RestoreAgentRequest) - -GetValidationResultRequest = _reflection.GeneratedProtocolMessageType( - "GetValidationResultRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETVALIDATIONRESULTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.agent_pb2", - "__doc__": """The request message for [Agents.GetValidationResult][google.cloud.dial - ogflow.v2.Agents.GetValidationResult]. - - Attributes: - parent: - Required. The project that the agent is associated with. - Format: ``projects/``. - language_code: - Optional. The language for which you want a validation result. - If not specified, the agent’s default language is used. `Many - languages `__ are supported. Note: languages must be enabled in - the agent before they can be used. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.GetValidationResultRequest) - }, -) -_sym_db.RegisterMessage(GetValidationResultRequest) - - -DESCRIPTOR._options = None -_AGENT.fields_by_name["parent"]._options = None -_AGENT.fields_by_name["display_name"]._options = None -_AGENT.fields_by_name["default_language_code"]._options = None -_AGENT.fields_by_name["supported_language_codes"]._options = None -_AGENT.fields_by_name["time_zone"]._options = None -_AGENT.fields_by_name["description"]._options = None -_AGENT.fields_by_name["avatar_uri"]._options = None -_AGENT.fields_by_name["enable_logging"]._options = None -_AGENT.fields_by_name["match_mode"]._options = None -_AGENT.fields_by_name["classification_threshold"]._options = None -_AGENT.fields_by_name["api_version"]._options = None -_AGENT.fields_by_name["tier"]._options = None -_AGENT._options = None -_GETAGENTREQUEST.fields_by_name["parent"]._options = None -_SETAGENTREQUEST.fields_by_name["agent"]._options = None -_SETAGENTREQUEST.fields_by_name["update_mask"]._options = None -_DELETEAGENTREQUEST.fields_by_name["parent"]._options = None -_SEARCHAGENTSREQUEST.fields_by_name["parent"]._options = None -_SEARCHAGENTSREQUEST.fields_by_name["page_size"]._options = None -_TRAINAGENTREQUEST.fields_by_name["parent"]._options = None -_EXPORTAGENTREQUEST.fields_by_name["parent"]._options = None -_EXPORTAGENTREQUEST.fields_by_name["agent_uri"]._options = None -_IMPORTAGENTREQUEST.fields_by_name["parent"]._options = None -_RESTOREAGENTREQUEST.fields_by_name["parent"]._options = None -_GETVALIDATIONRESULTREQUEST.fields_by_name["parent"]._options = None -_GETVALIDATIONRESULTREQUEST.fields_by_name["language_code"]._options = None - -_AGENTS = _descriptor.ServiceDescriptor( - name="Agents", - full_name="google.cloud.dialogflow.v2.Agents", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=2385, - serialized_end=4118, - methods=[ - _descriptor.MethodDescriptor( - name="GetAgent", - full_name="google.cloud.dialogflow.v2.Agents.GetAgent", - index=0, - containing_service=None, - input_type=_GETAGENTREQUEST, - output_type=_AGENT, - serialized_options=b"\202\323\344\223\002\037\022\035/v2/{parent=projects/*}/agent\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="SetAgent", - full_name="google.cloud.dialogflow.v2.Agents.SetAgent", - index=1, - containing_service=None, - input_type=_SETAGENTREQUEST, - output_type=_AGENT, - serialized_options=b'\202\323\344\223\002,"#/v2/{agent.parent=projects/*}/agent:\005agent\332A\005agent', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteAgent", - full_name="google.cloud.dialogflow.v2.Agents.DeleteAgent", - index=2, - containing_service=None, - input_type=_DELETEAGENTREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002\037*\035/v2/{parent=projects/*}/agent\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="SearchAgents", - full_name="google.cloud.dialogflow.v2.Agents.SearchAgents", - index=3, - containing_service=None, - input_type=_SEARCHAGENTSREQUEST, - output_type=_SEARCHAGENTSRESPONSE, - serialized_options=b"\202\323\344\223\002&\022$/v2/{parent=projects/*}/agent:search\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="TrainAgent", - full_name="google.cloud.dialogflow.v2.Agents.TrainAgent", - index=4, - containing_service=None, - input_type=_TRAINAGENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002("#/v2/{parent=projects/*}/agent:train:\001*\332A\006parent\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ExportAgent", - full_name="google.cloud.dialogflow.v2.Agents.ExportAgent", - index=5, - containing_service=None, - input_type=_EXPORTAGENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002)"$/v2/{parent=projects/*}/agent:export:\001*\332A\006parent\312AH\n.google.cloud.dialogflow.v2.ExportAgentResponse\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ImportAgent", - full_name="google.cloud.dialogflow.v2.Agents.ImportAgent", - index=6, - containing_service=None, - input_type=_IMPORTAGENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002)"$/v2/{parent=projects/*}/agent:import:\001*\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="RestoreAgent", - full_name="google.cloud.dialogflow.v2.Agents.RestoreAgent", - index=7, - containing_service=None, - input_type=_RESTOREAGENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002*"%/v2/{parent=projects/*}/agent:restore:\001*\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetValidationResult", - full_name="google.cloud.dialogflow.v2.Agents.GetValidationResult", - index=8, - containing_service=None, - input_type=_GETVALIDATIONRESULTREQUEST, - output_type=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_validation__result__pb2._VALIDATIONRESULT, - serialized_options=b"\202\323\344\223\0020\022./v2/{parent=projects/*}/agent/validationResult", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_AGENTS) - -DESCRIPTOR.services_by_name["Agents"] = _AGENTS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2/proto/agent_pb2_grpc.py b/dialogflow_v2/proto/agent_pb2_grpc.py deleted file mode 100644 index 7daf4105f..000000000 --- a/dialogflow_v2/proto/agent_pb2_grpc.py +++ /dev/null @@ -1,476 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2.proto import ( - agent_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2, -) -from dialogflow_v2.proto import ( - validation_result_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_validation__result__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class AgentsStub(object): - """Service for managing [Agents][google.cloud.dialogflow.v2.Agent]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.GetAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Agents/GetAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.GetAgentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.Agent.FromString, - ) - self.SetAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Agents/SetAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.SetAgentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.Agent.FromString, - ) - self.DeleteAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Agents/DeleteAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.DeleteAgentRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.SearchAgents = channel.unary_unary( - "/google.cloud.dialogflow.v2.Agents/SearchAgents", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.SearchAgentsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.SearchAgentsResponse.FromString, - ) - self.TrainAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Agents/TrainAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.TrainAgentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.ExportAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Agents/ExportAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.ExportAgentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.ImportAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Agents/ImportAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.ImportAgentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.RestoreAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Agents/RestoreAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.RestoreAgentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.GetValidationResult = channel.unary_unary( - "/google.cloud.dialogflow.v2.Agents/GetValidationResult", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.GetValidationResultRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_validation__result__pb2.ValidationResult.FromString, - ) - - -class AgentsServicer(object): - """Service for managing [Agents][google.cloud.dialogflow.v2.Agent]. - """ - - def GetAgent(self, request, context): - """Retrieves the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def SetAgent(self, request, context): - """Creates/updates the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteAgent(self, request, context): - """Deletes the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def SearchAgents(self, request, context): - """Returns the list of agents. - - Since there is at most one conversational agent per project, this method is - useful primarily for listing all agents across projects the caller has - access to. One can achieve that with a wildcard project collection id "-". - Refer to [List - Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def TrainAgent(self, request, context): - """Trains the specified agent. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ExportAgent(self, request, context): - """Exports the specified agent to a ZIP file. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ImportAgent(self, request, context): - """Imports the specified agent from a ZIP file. - - Uploads new intents and entity types without deleting the existing ones. - Intents and entity types with the same name are replaced with the new - versions from [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After the import, the imported draft - agent will be trained automatically (unless disabled in agent settings). - However, once the import is done, training may not be completed yet. Please - call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train - explicitly. - - Operation - An operation which tracks when importing is complete. It only tracks - when the draft agent is updated not when it is done training. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def RestoreAgent(self, request, context): - """Restores the specified agent from a ZIP file. - - Replaces the current agent version with a new one. All the intents and - entity types in the older version are deleted. After the restore, the - restored draft agent will be trained automatically (unless disabled in - agent settings). However, once the restore is done, training may not be - completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it - returns in order to train explicitly. - - Operation - An operation which tracks when restoring is complete. It only tracks - when the draft agent is updated not when it is done training. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetValidationResult(self, request, context): - """Gets agent validation result. Agent validation is performed during - training time and is updated automatically when training is completed. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_AgentsServicer_to_server(servicer, server): - rpc_method_handlers = { - "GetAgent": grpc.unary_unary_rpc_method_handler( - servicer.GetAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.GetAgentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.Agent.SerializeToString, - ), - "SetAgent": grpc.unary_unary_rpc_method_handler( - servicer.SetAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.SetAgentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.Agent.SerializeToString, - ), - "DeleteAgent": grpc.unary_unary_rpc_method_handler( - servicer.DeleteAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.DeleteAgentRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "SearchAgents": grpc.unary_unary_rpc_method_handler( - servicer.SearchAgents, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.SearchAgentsRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.SearchAgentsResponse.SerializeToString, - ), - "TrainAgent": grpc.unary_unary_rpc_method_handler( - servicer.TrainAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.TrainAgentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "ExportAgent": grpc.unary_unary_rpc_method_handler( - servicer.ExportAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.ExportAgentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "ImportAgent": grpc.unary_unary_rpc_method_handler( - servicer.ImportAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.ImportAgentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "RestoreAgent": grpc.unary_unary_rpc_method_handler( - servicer.RestoreAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.RestoreAgentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "GetValidationResult": grpc.unary_unary_rpc_method_handler( - servicer.GetValidationResult, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.GetValidationResultRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_validation__result__pb2.ValidationResult.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2.Agents", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Agents(object): - """Service for managing [Agents][google.cloud.dialogflow.v2.Agent]. - """ - - @staticmethod - def GetAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Agents/GetAgent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.GetAgentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.Agent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def SetAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Agents/SetAgent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.SetAgentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.Agent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Agents/DeleteAgent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.DeleteAgentRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def SearchAgents( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Agents/SearchAgents", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.SearchAgentsRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.SearchAgentsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def TrainAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Agents/TrainAgent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.TrainAgentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def ExportAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Agents/ExportAgent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.ExportAgentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def ImportAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Agents/ImportAgent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.ImportAgentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def RestoreAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Agents/RestoreAgent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.RestoreAgentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetValidationResult( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Agents/GetValidationResult", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_agent__pb2.GetValidationResultRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_validation__result__pb2.ValidationResult.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2/proto/audio_config_pb2.py b/dialogflow_v2/proto/audio_config_pb2.py deleted file mode 100644 index 4341cd28e..000000000 --- a/dialogflow_v2/proto/audio_config_pb2.py +++ /dev/null @@ -1,1163 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2/proto/audio_config.proto -"""Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2/proto/audio_config.proto", - package="google.cloud.dialogflow.v2", - syntax="proto3", - serialized_options=b"\n\036com.google.cloud.dialogflow.v2B\020AudioConfigProtoP\001ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cloud.Dialogflow.V2", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n3google/cloud/dialogflow_v2/proto/audio_config.proto\x12\x1agoogle.cloud.dialogflow.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/api/annotations.proto"/\n\rSpeechContext\x12\x0f\n\x07phrases\x18\x01 \x03(\t\x12\r\n\x05\x62oost\x18\x02 \x01(\x02"\x92\x01\n\x0eSpeechWordInfo\x12\x0c\n\x04word\x18\x03 \x01(\t\x12/\n\x0cstart_offset\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12-\n\nend_offset\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x12\n\nconfidence\x18\x04 \x01(\x02"\xef\x02\n\x10InputAudioConfig\x12\x41\n\x0e\x61udio_encoding\x18\x01 \x01(\x0e\x32).google.cloud.dialogflow.v2.AudioEncoding\x12\x19\n\x11sample_rate_hertz\x18\x02 \x01(\x05\x12\x15\n\rlanguage_code\x18\x03 \x01(\t\x12\x18\n\x10\x65nable_word_info\x18\r \x01(\x08\x12\x18\n\x0cphrase_hints\x18\x04 \x03(\tB\x02\x18\x01\x12\x42\n\x0fspeech_contexts\x18\x0b \x03(\x0b\x32).google.cloud.dialogflow.v2.SpeechContext\x12\r\n\x05model\x18\x07 \x01(\t\x12\x45\n\rmodel_variant\x18\n \x01(\x0e\x32..google.cloud.dialogflow.v2.SpeechModelVariant\x12\x18\n\x10single_utterance\x18\x08 \x01(\x08"f\n\x14VoiceSelectionParams\x12\x0c\n\x04name\x18\x01 \x01(\t\x12@\n\x0bssml_gender\x18\x02 \x01(\x0e\x32+.google.cloud.dialogflow.v2.SsmlVoiceGender"\xb3\x01\n\x16SynthesizeSpeechConfig\x12\x15\n\rspeaking_rate\x18\x01 \x01(\x01\x12\r\n\x05pitch\x18\x02 \x01(\x01\x12\x16\n\x0evolume_gain_db\x18\x03 \x01(\x01\x12\x1a\n\x12\x65\x66\x66\x65\x63ts_profile_id\x18\x05 \x03(\t\x12?\n\x05voice\x18\x04 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2.VoiceSelectionParams"\xd2\x01\n\x11OutputAudioConfig\x12L\n\x0e\x61udio_encoding\x18\x01 \x01(\x0e\x32/.google.cloud.dialogflow.v2.OutputAudioEncodingB\x03\xe0\x41\x02\x12\x19\n\x11sample_rate_hertz\x18\x02 \x01(\x05\x12T\n\x18synthesize_speech_config\x18\x03 \x01(\x0b\x32\x32.google.cloud.dialogflow.v2.SynthesizeSpeechConfig*\xfb\x01\n\rAudioEncoding\x12\x1e\n\x1a\x41UDIO_ENCODING_UNSPECIFIED\x10\x00\x12\x1c\n\x18\x41UDIO_ENCODING_LINEAR_16\x10\x01\x12\x17\n\x13\x41UDIO_ENCODING_FLAC\x10\x02\x12\x18\n\x14\x41UDIO_ENCODING_MULAW\x10\x03\x12\x16\n\x12\x41UDIO_ENCODING_AMR\x10\x04\x12\x19\n\x15\x41UDIO_ENCODING_AMR_WB\x10\x05\x12\x1b\n\x17\x41UDIO_ENCODING_OGG_OPUS\x10\x06\x12)\n%AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE\x10\x07*v\n\x12SpeechModelVariant\x12$\n SPEECH_MODEL_VARIANT_UNSPECIFIED\x10\x00\x12\x16\n\x12USE_BEST_AVAILABLE\x10\x01\x12\x10\n\x0cUSE_STANDARD\x10\x02\x12\x10\n\x0cUSE_ENHANCED\x10\x03*\x8d\x01\n\x0fSsmlVoiceGender\x12!\n\x1dSSML_VOICE_GENDER_UNSPECIFIED\x10\x00\x12\x1a\n\x16SSML_VOICE_GENDER_MALE\x10\x01\x12\x1c\n\x18SSML_VOICE_GENDER_FEMALE\x10\x02\x12\x1d\n\x19SSML_VOICE_GENDER_NEUTRAL\x10\x03*\xa4\x01\n\x13OutputAudioEncoding\x12%\n!OUTPUT_AUDIO_ENCODING_UNSPECIFIED\x10\x00\x12#\n\x1fOUTPUT_AUDIO_ENCODING_LINEAR_16\x10\x01\x12\x1d\n\x19OUTPUT_AUDIO_ENCODING_MP3\x10\x02\x12"\n\x1eOUTPUT_AUDIO_ENCODING_OGG_OPUS\x10\x03\x42\x9f\x01\n\x1e\x63om.google.cloud.dialogflow.v2B\x10\x41udioConfigProtoP\x01ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1aGoogle.Cloud.Dialogflow.V2b\x06proto3', - dependencies=[ - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - -_AUDIOENCODING = _descriptor.EnumDescriptor( - name="AudioEncoding", - full_name="google.cloud.dialogflow.v2.AudioEncoding", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_LINEAR_16", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_FLAC", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_MULAW", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_AMR", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_AMR_WB", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_OGG_OPUS", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1273, - serialized_end=1524, -) -_sym_db.RegisterEnumDescriptor(_AUDIOENCODING) - -AudioEncoding = enum_type_wrapper.EnumTypeWrapper(_AUDIOENCODING) -_SPEECHMODELVARIANT = _descriptor.EnumDescriptor( - name="SpeechModelVariant", - full_name="google.cloud.dialogflow.v2.SpeechModelVariant", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="SPEECH_MODEL_VARIANT_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="USE_BEST_AVAILABLE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="USE_STANDARD", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="USE_ENHANCED", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1526, - serialized_end=1644, -) -_sym_db.RegisterEnumDescriptor(_SPEECHMODELVARIANT) - -SpeechModelVariant = enum_type_wrapper.EnumTypeWrapper(_SPEECHMODELVARIANT) -_SSMLVOICEGENDER = _descriptor.EnumDescriptor( - name="SsmlVoiceGender", - full_name="google.cloud.dialogflow.v2.SsmlVoiceGender", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="SSML_VOICE_GENDER_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SSML_VOICE_GENDER_MALE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SSML_VOICE_GENDER_FEMALE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SSML_VOICE_GENDER_NEUTRAL", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1647, - serialized_end=1788, -) -_sym_db.RegisterEnumDescriptor(_SSMLVOICEGENDER) - -SsmlVoiceGender = enum_type_wrapper.EnumTypeWrapper(_SSMLVOICEGENDER) -_OUTPUTAUDIOENCODING = _descriptor.EnumDescriptor( - name="OutputAudioEncoding", - full_name="google.cloud.dialogflow.v2.OutputAudioEncoding", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="OUTPUT_AUDIO_ENCODING_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OUTPUT_AUDIO_ENCODING_LINEAR_16", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OUTPUT_AUDIO_ENCODING_MP3", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OUTPUT_AUDIO_ENCODING_OGG_OPUS", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1791, - serialized_end=1955, -) -_sym_db.RegisterEnumDescriptor(_OUTPUTAUDIOENCODING) - -OutputAudioEncoding = enum_type_wrapper.EnumTypeWrapper(_OUTPUTAUDIOENCODING) -AUDIO_ENCODING_UNSPECIFIED = 0 -AUDIO_ENCODING_LINEAR_16 = 1 -AUDIO_ENCODING_FLAC = 2 -AUDIO_ENCODING_MULAW = 3 -AUDIO_ENCODING_AMR = 4 -AUDIO_ENCODING_AMR_WB = 5 -AUDIO_ENCODING_OGG_OPUS = 6 -AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 -SPEECH_MODEL_VARIANT_UNSPECIFIED = 0 -USE_BEST_AVAILABLE = 1 -USE_STANDARD = 2 -USE_ENHANCED = 3 -SSML_VOICE_GENDER_UNSPECIFIED = 0 -SSML_VOICE_GENDER_MALE = 1 -SSML_VOICE_GENDER_FEMALE = 2 -SSML_VOICE_GENDER_NEUTRAL = 3 -OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0 -OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1 -OUTPUT_AUDIO_ENCODING_MP3 = 2 -OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3 - - -_SPEECHCONTEXT = _descriptor.Descriptor( - name="SpeechContext", - full_name="google.cloud.dialogflow.v2.SpeechContext", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="phrases", - full_name="google.cloud.dialogflow.v2.SpeechContext.phrases", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="boost", - full_name="google.cloud.dialogflow.v2.SpeechContext.boost", - index=1, - number=2, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=205, - serialized_end=252, -) - - -_SPEECHWORDINFO = _descriptor.Descriptor( - name="SpeechWordInfo", - full_name="google.cloud.dialogflow.v2.SpeechWordInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="word", - full_name="google.cloud.dialogflow.v2.SpeechWordInfo.word", - index=0, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="start_offset", - full_name="google.cloud.dialogflow.v2.SpeechWordInfo.start_offset", - index=1, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_offset", - full_name="google.cloud.dialogflow.v2.SpeechWordInfo.end_offset", - index=2, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="confidence", - full_name="google.cloud.dialogflow.v2.SpeechWordInfo.confidence", - index=3, - number=4, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=255, - serialized_end=401, -) - - -_INPUTAUDIOCONFIG = _descriptor.Descriptor( - name="InputAudioConfig", - full_name="google.cloud.dialogflow.v2.InputAudioConfig", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="audio_encoding", - full_name="google.cloud.dialogflow.v2.InputAudioConfig.audio_encoding", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sample_rate_hertz", - full_name="google.cloud.dialogflow.v2.InputAudioConfig.sample_rate_hertz", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.InputAudioConfig.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="enable_word_info", - full_name="google.cloud.dialogflow.v2.InputAudioConfig.enable_word_info", - index=3, - number=13, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="phrase_hints", - full_name="google.cloud.dialogflow.v2.InputAudioConfig.phrase_hints", - index=4, - number=4, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\030\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="speech_contexts", - full_name="google.cloud.dialogflow.v2.InputAudioConfig.speech_contexts", - index=5, - number=11, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="model", - full_name="google.cloud.dialogflow.v2.InputAudioConfig.model", - index=6, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="model_variant", - full_name="google.cloud.dialogflow.v2.InputAudioConfig.model_variant", - index=7, - number=10, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="single_utterance", - full_name="google.cloud.dialogflow.v2.InputAudioConfig.single_utterance", - index=8, - number=8, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=404, - serialized_end=771, -) - - -_VOICESELECTIONPARAMS = _descriptor.Descriptor( - name="VoiceSelectionParams", - full_name="google.cloud.dialogflow.v2.VoiceSelectionParams", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.VoiceSelectionParams.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="ssml_gender", - full_name="google.cloud.dialogflow.v2.VoiceSelectionParams.ssml_gender", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=773, - serialized_end=875, -) - - -_SYNTHESIZESPEECHCONFIG = _descriptor.Descriptor( - name="SynthesizeSpeechConfig", - full_name="google.cloud.dialogflow.v2.SynthesizeSpeechConfig", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="speaking_rate", - full_name="google.cloud.dialogflow.v2.SynthesizeSpeechConfig.speaking_rate", - index=0, - number=1, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="pitch", - full_name="google.cloud.dialogflow.v2.SynthesizeSpeechConfig.pitch", - index=1, - number=2, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="volume_gain_db", - full_name="google.cloud.dialogflow.v2.SynthesizeSpeechConfig.volume_gain_db", - index=2, - number=3, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="effects_profile_id", - full_name="google.cloud.dialogflow.v2.SynthesizeSpeechConfig.effects_profile_id", - index=3, - number=5, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="voice", - full_name="google.cloud.dialogflow.v2.SynthesizeSpeechConfig.voice", - index=4, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=878, - serialized_end=1057, -) - - -_OUTPUTAUDIOCONFIG = _descriptor.Descriptor( - name="OutputAudioConfig", - full_name="google.cloud.dialogflow.v2.OutputAudioConfig", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="audio_encoding", - full_name="google.cloud.dialogflow.v2.OutputAudioConfig.audio_encoding", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sample_rate_hertz", - full_name="google.cloud.dialogflow.v2.OutputAudioConfig.sample_rate_hertz", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="synthesize_speech_config", - full_name="google.cloud.dialogflow.v2.OutputAudioConfig.synthesize_speech_config", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1060, - serialized_end=1270, -) - -_SPEECHWORDINFO.fields_by_name[ - "start_offset" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_SPEECHWORDINFO.fields_by_name[ - "end_offset" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_INPUTAUDIOCONFIG.fields_by_name["audio_encoding"].enum_type = _AUDIOENCODING -_INPUTAUDIOCONFIG.fields_by_name["speech_contexts"].message_type = _SPEECHCONTEXT -_INPUTAUDIOCONFIG.fields_by_name["model_variant"].enum_type = _SPEECHMODELVARIANT -_VOICESELECTIONPARAMS.fields_by_name["ssml_gender"].enum_type = _SSMLVOICEGENDER -_SYNTHESIZESPEECHCONFIG.fields_by_name["voice"].message_type = _VOICESELECTIONPARAMS -_OUTPUTAUDIOCONFIG.fields_by_name["audio_encoding"].enum_type = _OUTPUTAUDIOENCODING -_OUTPUTAUDIOCONFIG.fields_by_name[ - "synthesize_speech_config" -].message_type = _SYNTHESIZESPEECHCONFIG -DESCRIPTOR.message_types_by_name["SpeechContext"] = _SPEECHCONTEXT -DESCRIPTOR.message_types_by_name["SpeechWordInfo"] = _SPEECHWORDINFO -DESCRIPTOR.message_types_by_name["InputAudioConfig"] = _INPUTAUDIOCONFIG -DESCRIPTOR.message_types_by_name["VoiceSelectionParams"] = _VOICESELECTIONPARAMS -DESCRIPTOR.message_types_by_name["SynthesizeSpeechConfig"] = _SYNTHESIZESPEECHCONFIG -DESCRIPTOR.message_types_by_name["OutputAudioConfig"] = _OUTPUTAUDIOCONFIG -DESCRIPTOR.enum_types_by_name["AudioEncoding"] = _AUDIOENCODING -DESCRIPTOR.enum_types_by_name["SpeechModelVariant"] = _SPEECHMODELVARIANT -DESCRIPTOR.enum_types_by_name["SsmlVoiceGender"] = _SSMLVOICEGENDER -DESCRIPTOR.enum_types_by_name["OutputAudioEncoding"] = _OUTPUTAUDIOENCODING -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -SpeechContext = _reflection.GeneratedProtocolMessageType( - "SpeechContext", - (_message.Message,), - { - "DESCRIPTOR": _SPEECHCONTEXT, - "__module__": "google.cloud.dialogflow_v2.proto.audio_config_pb2", - "__doc__": """Hints for the speech recognizer to help with recognition in a specific - conversation state. - - Attributes: - phrases: - Optional. A list of strings containing words and phrases that - the speech recognizer should recognize with higher likelihood. - This list can be used to: - improve accuracy for words and - phrases you expect the user to say, e.g. typical commands - for your Dialogflow agent - add additional words to the - speech recognizer vocabulary - … See the `Cloud Speech - documentation `__ for usage limits. - boost: - Optional. Boost for this context compared to other contexts: - - If the boost is positive, Dialogflow will increase the - probability that the phrases in this context are recognized - over similar sounding phrases. - If the boost is - unspecified or non-positive, Dialogflow will not apply any - boost. Dialogflow recommends that you use boosts in the range - (0, 20] and that you find a value that fits your use case with - binary search. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.SpeechContext) - }, -) -_sym_db.RegisterMessage(SpeechContext) - -SpeechWordInfo = _reflection.GeneratedProtocolMessageType( - "SpeechWordInfo", - (_message.Message,), - { - "DESCRIPTOR": _SPEECHWORDINFO, - "__module__": "google.cloud.dialogflow_v2.proto.audio_config_pb2", - "__doc__": """Information for a word recognized by the speech recognizer. - - Attributes: - word: - The word this info is for. - start_offset: - Time offset relative to the beginning of the audio that - corresponds to the start of the spoken word. This is an - experimental feature and the accuracy of the time offset can - vary. - end_offset: - Time offset relative to the beginning of the audio that - corresponds to the end of the spoken word. This is an - experimental feature and the accuracy of the time offset can - vary. - confidence: - The Speech confidence between 0.0 and 1.0 for this word. A - higher number indicates an estimated greater likelihood that - the recognized word is correct. The default of 0.0 is a - sentinel value indicating that confidence was not set. This - field is not guaranteed to be fully stable over time for the - same audio input. Users should also not rely on it to always - be provided. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.SpeechWordInfo) - }, -) -_sym_db.RegisterMessage(SpeechWordInfo) - -InputAudioConfig = _reflection.GeneratedProtocolMessageType( - "InputAudioConfig", - (_message.Message,), - { - "DESCRIPTOR": _INPUTAUDIOCONFIG, - "__module__": "google.cloud.dialogflow_v2.proto.audio_config_pb2", - "__doc__": """Instructs the speech recognizer how to process the audio content. - - Attributes: - audio_encoding: - Required. Audio encoding of the audio content to process. - sample_rate_hertz: - Required. Sample rate (in Hertz) of the audio content sent in - the query. Refer to `Cloud Speech API documentation - `__ for - more details. - language_code: - Required. The language of the supplied audio. Dialogflow does - not do translations. See `Language Support `__ for a list of - the currently supported language codes. Note that queries in - the same session do not necessarily need to specify the same - language. - enable_word_info: - If ``true``, Dialogflow returns - [SpeechWordInfo][google.cloud.dialogflow.v2.SpeechWordInfo] in - [StreamingRecognitionResult][google.cloud.dialogflow.v2.Stream - ingRecognitionResult] with information about the recognized - speech words, e.g. start and end time offsets. If false or - unspecified, Speech doesn’t return any word-level information. - phrase_hints: - A list of strings containing words and phrases that the speech - recognizer should recognize with higher likelihood. See `the - Cloud Speech documentation `__ for more details. This - field is deprecated. Please use `speech_contexts` - instead. If you specify both `phrase_hints` and - `speech_contexts`, Dialogflow will treat the - `phrase_hints` as a single additional `SpeechContext`. - speech_contexts: - Context information to assist speech recognition. See `the - Cloud Speech documentation `__ for more details. - model: - Which Speech model to select for the given request. Select the - model best suited to your domain to get best results. If a - model is not explicitly specified, then we auto-select a model - based on the parameters in the InputAudioConfig. If enhanced - speech model is enabled for the agent and an enhanced version - of the specified model for the language does not exist, then - the speech is recognized using the standard version of the - specified model. Refer to `Cloud Speech API documentation - `__ for more details. - model_variant: - Which variant of the [Speech - model][google.cloud.dialogflow.v2.InputAudioConfig.model] to - use. - single_utterance: - If ``false`` (default), recognition does not cease until the - client closes the stream. If ``true``, the recognizer will - detect a single spoken utterance in input audio. Recognition - ceases when it detects the audio’s voice has stopped or - paused. In this case, once a detected intent is received, the - client should close the stream and start a new request with a - new stream as needed. Note: This setting is relevant only for - streaming methods. Note: When specified, - InputAudioConfig.single_utterance takes precedence over - StreamingDetectIntentRequest.single_utterance. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.InputAudioConfig) - }, -) -_sym_db.RegisterMessage(InputAudioConfig) - -VoiceSelectionParams = _reflection.GeneratedProtocolMessageType( - "VoiceSelectionParams", - (_message.Message,), - { - "DESCRIPTOR": _VOICESELECTIONPARAMS, - "__module__": "google.cloud.dialogflow_v2.proto.audio_config_pb2", - "__doc__": """Description of which voice to use for speech synthesis. - - Attributes: - name: - Optional. The name of the voice. If not set, the service will - choose a voice based on the other parameters such as - language_code and [ssml_gender][google.cloud.dialogflow.v2.Voi - ceSelectionParams.ssml_gender]. - ssml_gender: - Optional. The preferred gender of the voice. If not set, the - service will choose a voice based on the other parameters such - as language_code and - [name][google.cloud.dialogflow.v2.VoiceSelectionParams.name]. - Note that this is only a preference, not requirement. If a - voice of the appropriate gender is not available, the - synthesizer should substitute a voice with a different gender - rather than failing the request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.VoiceSelectionParams) - }, -) -_sym_db.RegisterMessage(VoiceSelectionParams) - -SynthesizeSpeechConfig = _reflection.GeneratedProtocolMessageType( - "SynthesizeSpeechConfig", - (_message.Message,), - { - "DESCRIPTOR": _SYNTHESIZESPEECHCONFIG, - "__module__": "google.cloud.dialogflow_v2.proto.audio_config_pb2", - "__doc__": """Configuration of how speech should be synthesized. - - Attributes: - speaking_rate: - Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 - is the normal native speed supported by the specific voice. - 2.0 is twice as fast, and 0.5 is half as fast. If unset(0.0), - defaults to the native 1.0 speed. Any other values < 0.25 or > - 4.0 will return an error. - pitch: - Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means - increase 20 semitones from the original pitch. -20 means - decrease 20 semitones from the original pitch. - volume_gain_db: - Optional. Volume gain (in dB) of the normal native volume - supported by the specific voice, in the range [-96.0, 16.0]. - If unset, or set to a value of 0.0 (dB), will play at normal - native signal amplitude. A value of -6.0 (dB) will play at - approximately half the amplitude of the normal native signal - amplitude. A value of +6.0 (dB) will play at approximately - twice the amplitude of the normal native signal amplitude. We - strongly recommend not to exceed +10 (dB) as there’s usually - no effective increase in loudness for any value greater than - that. - effects_profile_id: - Optional. An identifier which selects ‘audio effects’ profiles - that are applied on (post synthesized) text to speech. Effects - are applied on top of each other in the order they are given. - voice: - Optional. The desired voice of the synthesized audio. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.SynthesizeSpeechConfig) - }, -) -_sym_db.RegisterMessage(SynthesizeSpeechConfig) - -OutputAudioConfig = _reflection.GeneratedProtocolMessageType( - "OutputAudioConfig", - (_message.Message,), - { - "DESCRIPTOR": _OUTPUTAUDIOCONFIG, - "__module__": "google.cloud.dialogflow_v2.proto.audio_config_pb2", - "__doc__": """Instructs the speech synthesizer on how to generate the output audio - content. If this audio config is supplied in a request, it overrides - all existing text-to-speech settings applied to the agent. - - Attributes: - audio_encoding: - Required. Audio encoding of the synthesized audio content. - sample_rate_hertz: - The synthesis sample rate (in hertz) for this audio. If not - provided, then the synthesizer will use the default sample - rate based on the audio encoding. If this is different from - the voice’s natural sample rate, then the synthesizer will - honor this request by converting to the desired sample rate - (which might result in worse audio quality). - synthesize_speech_config: - Configuration of how speech should be synthesized. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.OutputAudioConfig) - }, -) -_sym_db.RegisterMessage(OutputAudioConfig) - - -DESCRIPTOR._options = None -_INPUTAUDIOCONFIG.fields_by_name["phrase_hints"]._options = None -_OUTPUTAUDIOCONFIG.fields_by_name["audio_encoding"]._options = None -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2/proto/audio_config_pb2_grpc.py b/dialogflow_v2/proto/audio_config_pb2_grpc.py deleted file mode 100644 index 8a9393943..000000000 --- a/dialogflow_v2/proto/audio_config_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/dialogflow_v2/proto/context_pb2.py b/dialogflow_v2/proto/context_pb2.py deleted file mode 100644 index 511270c37..000000000 --- a/dialogflow_v2/proto/context_pb2.py +++ /dev/null @@ -1,843 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2/proto/context.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2/proto/context.proto", - package="google.cloud.dialogflow.v2", - syntax="proto3", - serialized_options=b"\n\036com.google.cloud.dialogflow.v2B\014ContextProtoP\001ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cloud.Dialogflow.V2", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n.google/cloud/dialogflow_v2/proto/context.proto\x12\x1agoogle.cloud.dialogflow.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/protobuf/struct.proto"\xbd\x02\n\x07\x43ontext\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1b\n\x0elifespan_count\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x30\n\nparameters\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructB\x03\xe0\x41\x01:\xcf\x01\xea\x41\xcb\x01\n!dialogflow.googleapis.com/Context\x12>projects/{project}/agent/sessions/{session}/contexts/{context}\x12\x66projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}"\x81\x01\n\x13ListContextsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\x12!dialogflow.googleapis.com/Context\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01"f\n\x14ListContextsResponse\x12\x35\n\x08\x63ontexts\x18\x01 \x03(\x0b\x32#.google.cloud.dialogflow.v2.Context\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"L\n\x11GetContextRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!dialogflow.googleapis.com/Context"\x8c\x01\n\x14\x43reateContextRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\x12!dialogflow.googleapis.com/Context\x12\x39\n\x07\x63ontext\x18\x02 \x01(\x0b\x32#.google.cloud.dialogflow.v2.ContextB\x03\xe0\x41\x02"\x87\x01\n\x14UpdateContextRequest\x12\x39\n\x07\x63ontext\x18\x01 \x01(\x0b\x32#.google.cloud.dialogflow.v2.ContextB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01"O\n\x14\x44\x65leteContextRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!dialogflow.googleapis.com/Context"U\n\x18\x44\x65leteAllContextsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\x12!dialogflow.googleapis.com/Context2\x9a\r\n\x08\x43ontexts\x12\x82\x02\n\x0cListContexts\x12/.google.cloud.dialogflow.v2.ListContextsRequest\x1a\x30.google.cloud.dialogflow.v2.ListContextsResponse"\x8e\x01\x82\xd3\xe4\x93\x02\x7f\x12\x31/v2/{parent=projects/*/agent/sessions/*}/contextsZJ\x12H/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts\xda\x41\x06parent\x12\xef\x01\n\nGetContext\x12-.google.cloud.dialogflow.v2.GetContextRequest\x1a#.google.cloud.dialogflow.v2.Context"\x8c\x01\x82\xd3\xe4\x93\x02\x7f\x12\x31/v2/{name=projects/*/agent/sessions/*/contexts/*}ZJ\x12H/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}\xda\x41\x04name\x12\x92\x02\n\rCreateContext\x12\x30.google.cloud.dialogflow.v2.CreateContextRequest\x1a#.google.cloud.dialogflow.v2.Context"\xa9\x01\x82\xd3\xe4\x93\x02\x91\x01"1/v2/{parent=projects/*/agent/sessions/*}/contexts:\x07\x63ontextZS"H/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts:\x07\x63ontext\xda\x41\x0eparent,context\x12\xa7\x02\n\rUpdateContext\x12\x30.google.cloud.dialogflow.v2.UpdateContextRequest\x1a#.google.cloud.dialogflow.v2.Context"\xbe\x01\x82\xd3\xe4\x93\x02\xa1\x01\x32\x39/v2/{context.name=projects/*/agent/sessions/*/contexts/*}:\x07\x63ontextZ[2P/v2/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}:\x07\x63ontext\xda\x41\x13\x63ontext,update_mask\x12\xe8\x01\n\rDeleteContext\x12\x30.google.cloud.dialogflow.v2.DeleteContextRequest\x1a\x16.google.protobuf.Empty"\x8c\x01\x82\xd3\xe4\x93\x02\x7f*1/v2/{name=projects/*/agent/sessions/*/contexts/*}ZJ*H/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}\xda\x41\x04name\x12\xf2\x01\n\x11\x44\x65leteAllContexts\x12\x34.google.cloud.dialogflow.v2.DeleteAllContextsRequest\x1a\x16.google.protobuf.Empty"\x8e\x01\x82\xd3\xe4\x93\x02\x7f*1/v2/{parent=projects/*/agent/sessions/*}/contextsZJ*H/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts\xda\x41\x06parent\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\x9b\x01\n\x1e\x63om.google.cloud.dialogflow.v2B\x0c\x43ontextProtoP\x01ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1aGoogle.Cloud.Dialogflow.V2b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, - ], -) - - -_CONTEXT = _descriptor.Descriptor( - name="Context", - full_name="google.cloud.dialogflow.v2.Context", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.Context.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="lifespan_count", - full_name="google.cloud.dialogflow.v2.Context.lifespan_count", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parameters", - full_name="google.cloud.dialogflow.v2.Context.parameters", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"\352A\313\001\n!dialogflow.googleapis.com/Context\022>projects/{project}/agent/sessions/{session}/contexts/{context}\022fprojects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=287, - serialized_end=604, -) - - -_LISTCONTEXTSREQUEST = _descriptor.Descriptor( - name="ListContextsRequest", - full_name="google.cloud.dialogflow.v2.ListContextsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.ListContextsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\022!dialogflow.googleapis.com/Context", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2.ListContextsRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2.ListContextsRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=607, - serialized_end=736, -) - - -_LISTCONTEXTSRESPONSE = _descriptor.Descriptor( - name="ListContextsResponse", - full_name="google.cloud.dialogflow.v2.ListContextsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="contexts", - full_name="google.cloud.dialogflow.v2.ListContextsResponse.contexts", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2.ListContextsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=738, - serialized_end=840, -) - - -_GETCONTEXTREQUEST = _descriptor.Descriptor( - name="GetContextRequest", - full_name="google.cloud.dialogflow.v2.GetContextRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.GetContextRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\n!dialogflow.googleapis.com/Context", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=842, - serialized_end=918, -) - - -_CREATECONTEXTREQUEST = _descriptor.Descriptor( - name="CreateContextRequest", - full_name="google.cloud.dialogflow.v2.CreateContextRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.CreateContextRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\022!dialogflow.googleapis.com/Context", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="context", - full_name="google.cloud.dialogflow.v2.CreateContextRequest.context", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=921, - serialized_end=1061, -) - - -_UPDATECONTEXTREQUEST = _descriptor.Descriptor( - name="UpdateContextRequest", - full_name="google.cloud.dialogflow.v2.UpdateContextRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="context", - full_name="google.cloud.dialogflow.v2.UpdateContextRequest.context", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2.UpdateContextRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1064, - serialized_end=1199, -) - - -_DELETECONTEXTREQUEST = _descriptor.Descriptor( - name="DeleteContextRequest", - full_name="google.cloud.dialogflow.v2.DeleteContextRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.DeleteContextRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\n!dialogflow.googleapis.com/Context", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1201, - serialized_end=1280, -) - - -_DELETEALLCONTEXTSREQUEST = _descriptor.Descriptor( - name="DeleteAllContextsRequest", - full_name="google.cloud.dialogflow.v2.DeleteAllContextsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.DeleteAllContextsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\022!dialogflow.googleapis.com/Context", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1282, - serialized_end=1367, -) - -_CONTEXT.fields_by_name[ - "parameters" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_LISTCONTEXTSRESPONSE.fields_by_name["contexts"].message_type = _CONTEXT -_CREATECONTEXTREQUEST.fields_by_name["context"].message_type = _CONTEXT -_UPDATECONTEXTREQUEST.fields_by_name["context"].message_type = _CONTEXT -_UPDATECONTEXTREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -DESCRIPTOR.message_types_by_name["Context"] = _CONTEXT -DESCRIPTOR.message_types_by_name["ListContextsRequest"] = _LISTCONTEXTSREQUEST -DESCRIPTOR.message_types_by_name["ListContextsResponse"] = _LISTCONTEXTSRESPONSE -DESCRIPTOR.message_types_by_name["GetContextRequest"] = _GETCONTEXTREQUEST -DESCRIPTOR.message_types_by_name["CreateContextRequest"] = _CREATECONTEXTREQUEST -DESCRIPTOR.message_types_by_name["UpdateContextRequest"] = _UPDATECONTEXTREQUEST -DESCRIPTOR.message_types_by_name["DeleteContextRequest"] = _DELETECONTEXTREQUEST -DESCRIPTOR.message_types_by_name["DeleteAllContextsRequest"] = _DELETEALLCONTEXTSREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Context = _reflection.GeneratedProtocolMessageType( - "Context", - (_message.Message,), - { - "DESCRIPTOR": _CONTEXT, - "__module__": "google.cloud.dialogflow_v2.proto.context_pb2", - "__doc__": """Dialogflow contexts are similar to natural language context. If a - person says to you “they are orange”, you need context in order to - understand what “they” is referring to. Similarly, for Dialogflow to - handle an end-user expression like that, it needs to be provided with - context in order to correctly match an intent. Using contexts, you - can control the flow of a conversation. You can configure contexts for - an intent by setting input and output contexts, which are identified - by string names. When an intent is matched, any configured output - contexts for that intent become active. While any contexts are active, - Dialogflow is more likely to match intents that are configured with - input contexts that correspond to the currently active contexts. For - more information about context, see the `Contexts guide - `__. - - Attributes: - name: - Required. The unique identifier of the context. Format: - ``projects//agent/sessions//contexts/``, or ``projects//agent/environments//users//sessions//contexts/``. The - ``Context ID`` is always converted to lowercase, may only - contain characters in a-zA-Z0-9_-% and may be at most 250 - bytes long. If ``Environment ID`` is not specified, we assume - default ‘draft’ environment. If ``User ID`` is not specified, - we assume default ‘-’ user. The following context names are - reserved for internal use by Dialogflow. You should not use - these contexts or create contexts with these names: - - ``__system_counters__`` - ``*_id_dialog_context`` - - ``*_dialog_params_size`` - lifespan_count: - Optional. The number of conversational query requests after - which the context expires. The default is ``0``. If set to - ``0``, the context expires immediately. Contexts expire - automatically after 20 minutes if there are no matching - queries. - parameters: - Optional. The collection of parameters associated with this - context. 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: string or - number, depending on parameter value type - MapValue value: - - If parameter’s entity type is a composite entity: map from - composite entity property names to property values - Else: - parameter value - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Context) - }, -) -_sym_db.RegisterMessage(Context) - -ListContextsRequest = _reflection.GeneratedProtocolMessageType( - "ListContextsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTCONTEXTSREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.context_pb2", - "__doc__": """The request message for [Contexts.ListContexts][google.cloud.dialogflo - w.v2.Contexts.ListContexts]. - - Attributes: - parent: - Required. The session to list all contexts from. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users//sessions/``. If ``Environment - ID`` is not specified, we assume default ‘draft’ environment. - If ``User ID`` is not specified, we assume default ‘-’ user. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ListContextsRequest) - }, -) -_sym_db.RegisterMessage(ListContextsRequest) - -ListContextsResponse = _reflection.GeneratedProtocolMessageType( - "ListContextsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTCONTEXTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.context_pb2", - "__doc__": """The response message for [Contexts.ListContexts][google.cloud.dialogfl - ow.v2.Contexts.ListContexts]. - - Attributes: - contexts: - The list of contexts. There will be a maximum number of items - returned based on the page_size field in the request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ListContextsResponse) - }, -) -_sym_db.RegisterMessage(ListContextsResponse) - -GetContextRequest = _reflection.GeneratedProtocolMessageType( - "GetContextRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETCONTEXTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.context_pb2", - "__doc__": """The request message for - [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext]. - - Attributes: - name: - Required. The name of the context. Format: ``projects//agent/sessions//contexts/`` or - ``projects//agent/environments//users//sessions//contexts/``. If ``Environment ID`` is not specified, we assume - default ‘draft’ environment. If ``User ID`` is not specified, - we assume default ‘-’ user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.GetContextRequest) - }, -) -_sym_db.RegisterMessage(GetContextRequest) - -CreateContextRequest = _reflection.GeneratedProtocolMessageType( - "CreateContextRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATECONTEXTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.context_pb2", - "__doc__": """The request message for [Contexts.CreateContext][google.cloud.dialogfl - ow.v2.Contexts.CreateContext]. - - Attributes: - parent: - Required. The session to create a context for. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users//sessions/``. If ``Environment - ID`` is not specified, we assume default ‘draft’ environment. - If ``User ID`` is not specified, we assume default ‘-’ user. - context: - Required. The context to create. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.CreateContextRequest) - }, -) -_sym_db.RegisterMessage(CreateContextRequest) - -UpdateContextRequest = _reflection.GeneratedProtocolMessageType( - "UpdateContextRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATECONTEXTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.context_pb2", - "__doc__": """The request message for [Contexts.UpdateContext][google.cloud.dialogfl - ow.v2.Contexts.UpdateContext]. - - Attributes: - context: - Required. The context to update. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.UpdateContextRequest) - }, -) -_sym_db.RegisterMessage(UpdateContextRequest) - -DeleteContextRequest = _reflection.GeneratedProtocolMessageType( - "DeleteContextRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETECONTEXTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.context_pb2", - "__doc__": """The request message for [Contexts.DeleteContext][google.cloud.dialogfl - ow.v2.Contexts.DeleteContext]. - - Attributes: - name: - Required. The name of the context to delete. Format: - ``projects//agent/sessions//contexts/`` or ``projects//agent/environments//users//sessions//contexts/``. If - ``Environment ID`` is not specified, we assume default ‘draft’ - environment. If ``User ID`` is not specified, we assume - default ‘-’ user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.DeleteContextRequest) - }, -) -_sym_db.RegisterMessage(DeleteContextRequest) - -DeleteAllContextsRequest = _reflection.GeneratedProtocolMessageType( - "DeleteAllContextsRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEALLCONTEXTSREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.context_pb2", - "__doc__": """The request message for [Contexts.DeleteAllContexts][google.cloud.dial - ogflow.v2.Contexts.DeleteAllContexts]. - - Attributes: - parent: - Required. The name of the session to delete all contexts from. - Format: ``projects//agent/sessions/`` - or ``projects//agent/environments//users//sessions/``. If ``Environment - ID`` is not specified we assume default ‘draft’ environment. - If ``User ID`` is not specified, we assume default ‘-’ user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.DeleteAllContextsRequest) - }, -) -_sym_db.RegisterMessage(DeleteAllContextsRequest) - - -DESCRIPTOR._options = None -_CONTEXT.fields_by_name["name"]._options = None -_CONTEXT.fields_by_name["lifespan_count"]._options = None -_CONTEXT.fields_by_name["parameters"]._options = None -_CONTEXT._options = None -_LISTCONTEXTSREQUEST.fields_by_name["parent"]._options = None -_LISTCONTEXTSREQUEST.fields_by_name["page_size"]._options = None -_LISTCONTEXTSREQUEST.fields_by_name["page_token"]._options = None -_GETCONTEXTREQUEST.fields_by_name["name"]._options = None -_CREATECONTEXTREQUEST.fields_by_name["parent"]._options = None -_CREATECONTEXTREQUEST.fields_by_name["context"]._options = None -_UPDATECONTEXTREQUEST.fields_by_name["context"]._options = None -_UPDATECONTEXTREQUEST.fields_by_name["update_mask"]._options = None -_DELETECONTEXTREQUEST.fields_by_name["name"]._options = None -_DELETEALLCONTEXTSREQUEST.fields_by_name["parent"]._options = None - -_CONTEXTS = _descriptor.ServiceDescriptor( - name="Contexts", - full_name="google.cloud.dialogflow.v2.Contexts", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=1370, - serialized_end=3060, - methods=[ - _descriptor.MethodDescriptor( - name="ListContexts", - full_name="google.cloud.dialogflow.v2.Contexts.ListContexts", - index=0, - containing_service=None, - input_type=_LISTCONTEXTSREQUEST, - output_type=_LISTCONTEXTSRESPONSE, - serialized_options=b"\202\323\344\223\002\177\0221/v2/{parent=projects/*/agent/sessions/*}/contextsZJ\022H/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetContext", - full_name="google.cloud.dialogflow.v2.Contexts.GetContext", - index=1, - containing_service=None, - input_type=_GETCONTEXTREQUEST, - output_type=_CONTEXT, - serialized_options=b"\202\323\344\223\002\177\0221/v2/{name=projects/*/agent/sessions/*/contexts/*}ZJ\022H/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateContext", - full_name="google.cloud.dialogflow.v2.Contexts.CreateContext", - index=2, - containing_service=None, - input_type=_CREATECONTEXTREQUEST, - output_type=_CONTEXT, - serialized_options=b'\202\323\344\223\002\221\001"1/v2/{parent=projects/*/agent/sessions/*}/contexts:\007contextZS"H/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts:\007context\332A\016parent,context', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateContext", - full_name="google.cloud.dialogflow.v2.Contexts.UpdateContext", - index=3, - containing_service=None, - input_type=_UPDATECONTEXTREQUEST, - output_type=_CONTEXT, - serialized_options=b"\202\323\344\223\002\241\00129/v2/{context.name=projects/*/agent/sessions/*/contexts/*}:\007contextZ[2P/v2/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}:\007context\332A\023context,update_mask", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteContext", - full_name="google.cloud.dialogflow.v2.Contexts.DeleteContext", - index=4, - containing_service=None, - input_type=_DELETECONTEXTREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002\177*1/v2/{name=projects/*/agent/sessions/*/contexts/*}ZJ*H/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteAllContexts", - full_name="google.cloud.dialogflow.v2.Contexts.DeleteAllContexts", - index=5, - containing_service=None, - input_type=_DELETEALLCONTEXTSREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002\177*1/v2/{parent=projects/*/agent/sessions/*}/contextsZJ*H/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_CONTEXTS) - -DESCRIPTOR.services_by_name["Contexts"] = _CONTEXTS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2/proto/context_pb2_grpc.py b/dialogflow_v2/proto/context_pb2_grpc.py deleted file mode 100644 index 0e91897f2..000000000 --- a/dialogflow_v2/proto/context_pb2_grpc.py +++ /dev/null @@ -1,306 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2.proto import ( - context_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class ContextsStub(object): - """Service for managing [Contexts][google.cloud.dialogflow.v2.Context]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListContexts = channel.unary_unary( - "/google.cloud.dialogflow.v2.Contexts/ListContexts", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.ListContextsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.ListContextsResponse.FromString, - ) - self.GetContext = channel.unary_unary( - "/google.cloud.dialogflow.v2.Contexts/GetContext", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.GetContextRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.Context.FromString, - ) - self.CreateContext = channel.unary_unary( - "/google.cloud.dialogflow.v2.Contexts/CreateContext", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.CreateContextRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.Context.FromString, - ) - self.UpdateContext = channel.unary_unary( - "/google.cloud.dialogflow.v2.Contexts/UpdateContext", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.UpdateContextRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.Context.FromString, - ) - self.DeleteContext = channel.unary_unary( - "/google.cloud.dialogflow.v2.Contexts/DeleteContext", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.DeleteContextRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.DeleteAllContexts = channel.unary_unary( - "/google.cloud.dialogflow.v2.Contexts/DeleteAllContexts", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.DeleteAllContextsRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - - -class ContextsServicer(object): - """Service for managing [Contexts][google.cloud.dialogflow.v2.Context]. - """ - - def ListContexts(self, request, context): - """Returns the list of all contexts in the specified session. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetContext(self, request, context): - """Retrieves the specified context. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateContext(self, request, context): - """Creates a context. - - If the specified context already exists, overrides the context. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateContext(self, request, context): - """Updates the specified context. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteContext(self, request, context): - """Deletes the specified context. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteAllContexts(self, request, context): - """Deletes all active contexts in the specified session. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_ContextsServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListContexts": grpc.unary_unary_rpc_method_handler( - servicer.ListContexts, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.ListContextsRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.ListContextsResponse.SerializeToString, - ), - "GetContext": grpc.unary_unary_rpc_method_handler( - servicer.GetContext, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.GetContextRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.Context.SerializeToString, - ), - "CreateContext": grpc.unary_unary_rpc_method_handler( - servicer.CreateContext, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.CreateContextRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.Context.SerializeToString, - ), - "UpdateContext": grpc.unary_unary_rpc_method_handler( - servicer.UpdateContext, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.UpdateContextRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.Context.SerializeToString, - ), - "DeleteContext": grpc.unary_unary_rpc_method_handler( - servicer.DeleteContext, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.DeleteContextRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "DeleteAllContexts": grpc.unary_unary_rpc_method_handler( - servicer.DeleteAllContexts, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.DeleteAllContextsRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2.Contexts", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Contexts(object): - """Service for managing [Contexts][google.cloud.dialogflow.v2.Context]. - """ - - @staticmethod - def ListContexts( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Contexts/ListContexts", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.ListContextsRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.ListContextsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetContext( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Contexts/GetContext", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.GetContextRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.Context.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateContext( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Contexts/CreateContext", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.CreateContextRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.Context.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateContext( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Contexts/UpdateContext", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.UpdateContextRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.Context.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteContext( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Contexts/DeleteContext", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.DeleteContextRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteAllContexts( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Contexts/DeleteAllContexts", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.DeleteAllContextsRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2/proto/entity_type_pb2.py b/dialogflow_v2/proto/entity_type_pb2.py deleted file mode 100644 index 5c145b9da..000000000 --- a/dialogflow_v2/proto/entity_type_pb2.py +++ /dev/null @@ -1,1888 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2/proto/entity_type.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2/proto/entity_type.proto", - package="google.cloud.dialogflow.v2", - syntax="proto3", - serialized_options=b"\n\036com.google.cloud.dialogflow.v2B\017EntityTypeProtoP\001ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cloud.Dialogflow.V2", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n2google/cloud/dialogflow_v2/proto/entity_type.proto\x12\x1agoogle.cloud.dialogflow.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\xf8\x04\n\nEntityType\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12>\n\x04kind\x18\x03 \x01(\x0e\x32+.google.cloud.dialogflow.v2.EntityType.KindB\x03\xe0\x41\x02\x12Z\n\x13\x61uto_expansion_mode\x18\x04 \x01(\x0e\x32\x38.google.cloud.dialogflow.v2.EntityType.AutoExpansionModeB\x03\xe0\x41\x01\x12\x44\n\x08\x65ntities\x18\x06 \x03(\x0b\x32-.google.cloud.dialogflow.v2.EntityType.EntityB\x03\xe0\x41\x01\x12$\n\x17\x65nable_fuzzy_extraction\x18\x07 \x01(\x08\x42\x03\xe0\x41\x01\x1a\x33\n\x06\x45ntity\x12\x12\n\x05value\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x15\n\x08synonyms\x18\x02 \x03(\tB\x03\xe0\x41\x02"J\n\x04Kind\x12\x14\n\x10KIND_UNSPECIFIED\x10\x00\x12\x0c\n\x08KIND_MAP\x10\x01\x12\r\n\tKIND_LIST\x10\x02\x12\x0f\n\x0bKIND_REGEXP\x10\x03"Y\n\x11\x41utoExpansionMode\x12#\n\x1f\x41UTO_EXPANSION_MODE_UNSPECIFIED\x10\x00\x12\x1f\n\x1b\x41UTO_EXPANSION_MODE_DEFAULT\x10\x01:]\xea\x41Z\n$dialogflow.googleapis.com/EntityType\x12\x32projects/{project}/agent/entityTypes/{entity_type}"\xa3\x01\n\x16ListEntityTypesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\x12$dialogflow.googleapis.com/EntityType\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x04 \x01(\tB\x03\xe0\x41\x01"p\n\x17ListEntityTypesResponse\x12<\n\x0c\x65ntity_types\x18\x01 \x03(\x0b\x32&.google.cloud.dialogflow.v2.EntityType\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"n\n\x14GetEntityTypeRequest\x12:\n\x04name\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$dialogflow.googleapis.com/EntityType\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01"\xb5\x01\n\x17\x43reateEntityTypeRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\x12$dialogflow.googleapis.com/EntityType\x12@\n\x0b\x65ntity_type\x18\x02 \x01(\x0b\x32&.google.cloud.dialogflow.v2.EntityTypeB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01"\xad\x01\n\x17UpdateEntityTypeRequest\x12@\n\x0b\x65ntity_type\x18\x01 \x01(\x0b\x32&.google.cloud.dialogflow.v2.EntityTypeB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x34\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01"U\n\x17\x44\x65leteEntityTypeRequest\x12:\n\x04name\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$dialogflow.googleapis.com/EntityType"\xb6\x02\n\x1d\x42\x61tchUpdateEntityTypesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\x12$dialogflow.googleapis.com/EntityType\x12\x1f\n\x15\x65ntity_type_batch_uri\x18\x02 \x01(\tH\x00\x12O\n\x18\x65ntity_type_batch_inline\x18\x03 \x01(\x0b\x32+.google.cloud.dialogflow.v2.EntityTypeBatchH\x00\x12\x1a\n\rlanguage_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x34\n\x0bupdate_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\x42\x13\n\x11\x65ntity_type_batch"^\n\x1e\x42\x61tchUpdateEntityTypesResponse\x12<\n\x0c\x65ntity_types\x18\x01 \x03(\x0b\x32&.google.cloud.dialogflow.v2.EntityType"}\n\x1d\x42\x61tchDeleteEntityTypesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\x12$dialogflow.googleapis.com/EntityType\x12\x1e\n\x11\x65ntity_type_names\x18\x02 \x03(\tB\x03\xe0\x41\x02"\xbc\x01\n\x1a\x42\x61tchCreateEntitiesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$dialogflow.googleapis.com/EntityType\x12\x44\n\x08\x65ntities\x18\x02 \x03(\x0b\x32-.google.cloud.dialogflow.v2.EntityType.EntityB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01"\xf2\x01\n\x1a\x42\x61tchUpdateEntitiesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$dialogflow.googleapis.com/EntityType\x12\x44\n\x08\x65ntities\x18\x02 \x03(\x0b\x32-.google.cloud.dialogflow.v2.EntityType.EntityB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x34\n\x0bupdate_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01"\x92\x01\n\x1a\x42\x61tchDeleteEntitiesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$dialogflow.googleapis.com/EntityType\x12\x1a\n\rentity_values\x18\x02 \x03(\tB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01"O\n\x0f\x45ntityTypeBatch\x12<\n\x0c\x65ntity_types\x18\x01 \x03(\x0b\x32&.google.cloud.dialogflow.v2.EntityType2\x80\x14\n\x0b\x45ntityTypes\x12\xcd\x01\n\x0fListEntityTypes\x12\x32.google.cloud.dialogflow.v2.ListEntityTypesRequest\x1a\x33.google.cloud.dialogflow.v2.ListEntityTypesResponse"Q\x82\xd3\xe4\x93\x02+\x12)/v2/{parent=projects/*/agent}/entityTypes\xda\x41\x06parent\xda\x41\x14parent,language_code\x12\xb8\x01\n\rGetEntityType\x12\x30.google.cloud.dialogflow.v2.GetEntityTypeRequest\x1a&.google.cloud.dialogflow.v2.EntityType"M\x82\xd3\xe4\x93\x02+\x12)/v2/{name=projects/*/agent/entityTypes/*}\xda\x41\x04name\xda\x41\x12name,language_code\x12\xe7\x01\n\x10\x43reateEntityType\x12\x33.google.cloud.dialogflow.v2.CreateEntityTypeRequest\x1a&.google.cloud.dialogflow.v2.EntityType"v\x82\xd3\xe4\x93\x02\x38")/v2/{parent=projects/*/agent}/entityTypes:\x0b\x65ntity_type\xda\x41\x12parent,entity_type\xda\x41 parent,entity_type,language_code\x12\xe5\x01\n\x10UpdateEntityType\x12\x33.google.cloud.dialogflow.v2.UpdateEntityTypeRequest\x1a&.google.cloud.dialogflow.v2.EntityType"t\x82\xd3\xe4\x93\x02\x44\x32\x35/v2/{entity_type.name=projects/*/agent/entityTypes/*}:\x0b\x65ntity_type\xda\x41\x0b\x65ntity_type\xda\x41\x19\x65ntity_type,language_code\x12\x99\x01\n\x10\x44\x65leteEntityType\x12\x33.google.cloud.dialogflow.v2.DeleteEntityTypeRequest\x1a\x16.google.protobuf.Empty"8\x82\xd3\xe4\x93\x02+*)/v2/{name=projects/*/agent/entityTypes/*}\xda\x41\x04name\x12\x8b\x02\n\x16\x42\x61tchUpdateEntityTypes\x12\x39.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest\x1a\x1d.google.longrunning.Operation"\x96\x01\x82\xd3\xe4\x93\x02:"5/v2/{parent=projects/*/agent}/entityTypes:batchUpdate:\x01*\xca\x41S\n9google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse\x12\x16google.protobuf.Struct\x12\x82\x02\n\x16\x42\x61tchDeleteEntityTypes\x12\x39.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest\x1a\x1d.google.longrunning.Operation"\x8d\x01\x82\xd3\xe4\x93\x02:"5/v2/{parent=projects/*/agent}/entityTypes:batchDelete:\x01*\xda\x41\x18parent,entity_type_names\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\x9e\x02\n\x13\x42\x61tchCreateEntities\x12\x36.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest\x1a\x1d.google.longrunning.Operation"\xaf\x01\x82\xd3\xe4\x93\x02\x45"@/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate:\x01*\xda\x41\x0fparent,entities\xda\x41\x1dparent,entities,language_code\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\x9e\x02\n\x13\x42\x61tchUpdateEntities\x12\x36.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest\x1a\x1d.google.longrunning.Operation"\xaf\x01\x82\xd3\xe4\x93\x02\x45"@/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate:\x01*\xda\x41\x0fparent,entities\xda\x41\x1dparent,entities,language_code\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\xa8\x02\n\x13\x42\x61tchDeleteEntities\x12\x36.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest\x1a\x1d.google.longrunning.Operation"\xb9\x01\x82\xd3\xe4\x93\x02\x45"@/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete:\x01*\xda\x41\x14parent,entity_values\xda\x41"parent,entity_values,language_code\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\x9e\x01\n\x1e\x63om.google.cloud.dialogflow.v2B\x0f\x45ntityTypeProtoP\x01ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1aGoogle.Cloud.Dialogflow.V2b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - ], -) - - -_ENTITYTYPE_KIND = _descriptor.EnumDescriptor( - name="Kind", - full_name="google.cloud.dialogflow.v2.EntityType.Kind", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="KIND_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="KIND_MAP", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="KIND_LIST", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="KIND_REGEXP", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=670, - serialized_end=744, -) -_sym_db.RegisterEnumDescriptor(_ENTITYTYPE_KIND) - -_ENTITYTYPE_AUTOEXPANSIONMODE = _descriptor.EnumDescriptor( - name="AutoExpansionMode", - full_name="google.cloud.dialogflow.v2.EntityType.AutoExpansionMode", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="AUTO_EXPANSION_MODE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUTO_EXPANSION_MODE_DEFAULT", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=746, - serialized_end=835, -) -_sym_db.RegisterEnumDescriptor(_ENTITYTYPE_AUTOEXPANSIONMODE) - - -_ENTITYTYPE_ENTITY = _descriptor.Descriptor( - name="Entity", - full_name="google.cloud.dialogflow.v2.EntityType.Entity", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="value", - full_name="google.cloud.dialogflow.v2.EntityType.Entity.value", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="synonyms", - full_name="google.cloud.dialogflow.v2.EntityType.Entity.synonyms", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=617, - serialized_end=668, -) - -_ENTITYTYPE = _descriptor.Descriptor( - name="EntityType", - full_name="google.cloud.dialogflow.v2.EntityType", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.EntityType.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.dialogflow.v2.EntityType.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="kind", - full_name="google.cloud.dialogflow.v2.EntityType.kind", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="auto_expansion_mode", - full_name="google.cloud.dialogflow.v2.EntityType.auto_expansion_mode", - index=3, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entities", - full_name="google.cloud.dialogflow.v2.EntityType.entities", - index=4, - number=6, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="enable_fuzzy_extraction", - full_name="google.cloud.dialogflow.v2.EntityType.enable_fuzzy_extraction", - index=5, - number=7, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_ENTITYTYPE_ENTITY], - enum_types=[_ENTITYTYPE_KIND, _ENTITYTYPE_AUTOEXPANSIONMODE], - serialized_options=b"\352AZ\n$dialogflow.googleapis.com/EntityType\0222projects/{project}/agent/entityTypes/{entity_type}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=298, - serialized_end=930, -) - - -_LISTENTITYTYPESREQUEST = _descriptor.Descriptor( - name="ListEntityTypesRequest", - full_name="google.cloud.dialogflow.v2.ListEntityTypesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.ListEntityTypesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\022$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.ListEntityTypesRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2.ListEntityTypesRequest.page_size", - index=2, - number=3, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2.ListEntityTypesRequest.page_token", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=933, - serialized_end=1096, -) - - -_LISTENTITYTYPESRESPONSE = _descriptor.Descriptor( - name="ListEntityTypesResponse", - full_name="google.cloud.dialogflow.v2.ListEntityTypesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="entity_types", - full_name="google.cloud.dialogflow.v2.ListEntityTypesResponse.entity_types", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2.ListEntityTypesResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1098, - serialized_end=1210, -) - - -_GETENTITYTYPEREQUEST = _descriptor.Descriptor( - name="GetEntityTypeRequest", - full_name="google.cloud.dialogflow.v2.GetEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.GetEntityTypeRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\n$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.GetEntityTypeRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1212, - serialized_end=1322, -) - - -_CREATEENTITYTYPEREQUEST = _descriptor.Descriptor( - name="CreateEntityTypeRequest", - full_name="google.cloud.dialogflow.v2.CreateEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.CreateEntityTypeRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\022$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type", - full_name="google.cloud.dialogflow.v2.CreateEntityTypeRequest.entity_type", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.CreateEntityTypeRequest.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1325, - serialized_end=1506, -) - - -_UPDATEENTITYTYPEREQUEST = _descriptor.Descriptor( - name="UpdateEntityTypeRequest", - full_name="google.cloud.dialogflow.v2.UpdateEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="entity_type", - full_name="google.cloud.dialogflow.v2.UpdateEntityTypeRequest.entity_type", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.UpdateEntityTypeRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2.UpdateEntityTypeRequest.update_mask", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1509, - serialized_end=1682, -) - - -_DELETEENTITYTYPEREQUEST = _descriptor.Descriptor( - name="DeleteEntityTypeRequest", - full_name="google.cloud.dialogflow.v2.DeleteEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.DeleteEntityTypeRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\n$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1684, - serialized_end=1769, -) - - -_BATCHUPDATEENTITYTYPESREQUEST = _descriptor.Descriptor( - name="BatchUpdateEntityTypesRequest", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\022$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type_batch_uri", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.entity_type_batch_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type_batch_inline", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.entity_type_batch_inline", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.language_code", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.update_mask", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="entity_type_batch", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.entity_type_batch", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=1772, - serialized_end=2082, -) - - -_BATCHUPDATEENTITYTYPESRESPONSE = _descriptor.Descriptor( - name="BatchUpdateEntityTypesResponse", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="entity_types", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse.entity_types", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2084, - serialized_end=2178, -) - - -_BATCHDELETEENTITYTYPESREQUEST = _descriptor.Descriptor( - name="BatchDeleteEntityTypesRequest", - full_name="google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\022$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type_names", - full_name="google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest.entity_type_names", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2180, - serialized_end=2305, -) - - -_BATCHCREATEENTITIESREQUEST = _descriptor.Descriptor( - name="BatchCreateEntitiesRequest", - full_name="google.cloud.dialogflow.v2.BatchCreateEntitiesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.BatchCreateEntitiesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\n$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entities", - full_name="google.cloud.dialogflow.v2.BatchCreateEntitiesRequest.entities", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.BatchCreateEntitiesRequest.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2308, - serialized_end=2496, -) - - -_BATCHUPDATEENTITIESREQUEST = _descriptor.Descriptor( - name="BatchUpdateEntitiesRequest", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\n$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entities", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.entities", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.update_mask", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2499, - serialized_end=2741, -) - - -_BATCHDELETEENTITIESREQUEST = _descriptor.Descriptor( - name="BatchDeleteEntitiesRequest", - full_name="google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\n$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_values", - full_name="google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest.entity_values", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2744, - serialized_end=2890, -) - - -_ENTITYTYPEBATCH = _descriptor.Descriptor( - name="EntityTypeBatch", - full_name="google.cloud.dialogflow.v2.EntityTypeBatch", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="entity_types", - full_name="google.cloud.dialogflow.v2.EntityTypeBatch.entity_types", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2892, - serialized_end=2971, -) - -_ENTITYTYPE_ENTITY.containing_type = _ENTITYTYPE -_ENTITYTYPE.fields_by_name["kind"].enum_type = _ENTITYTYPE_KIND -_ENTITYTYPE.fields_by_name[ - "auto_expansion_mode" -].enum_type = _ENTITYTYPE_AUTOEXPANSIONMODE -_ENTITYTYPE.fields_by_name["entities"].message_type = _ENTITYTYPE_ENTITY -_ENTITYTYPE_KIND.containing_type = _ENTITYTYPE -_ENTITYTYPE_AUTOEXPANSIONMODE.containing_type = _ENTITYTYPE -_LISTENTITYTYPESRESPONSE.fields_by_name["entity_types"].message_type = _ENTITYTYPE -_CREATEENTITYTYPEREQUEST.fields_by_name["entity_type"].message_type = _ENTITYTYPE -_UPDATEENTITYTYPEREQUEST.fields_by_name["entity_type"].message_type = _ENTITYTYPE -_UPDATEENTITYTYPEREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name[ - "entity_type_batch_inline" -].message_type = _ENTITYTYPEBATCH -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_BATCHUPDATEENTITYTYPESREQUEST.oneofs_by_name["entity_type_batch"].fields.append( - _BATCHUPDATEENTITYTYPESREQUEST.fields_by_name["entity_type_batch_uri"] -) -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name[ - "entity_type_batch_uri" -].containing_oneof = _BATCHUPDATEENTITYTYPESREQUEST.oneofs_by_name["entity_type_batch"] -_BATCHUPDATEENTITYTYPESREQUEST.oneofs_by_name["entity_type_batch"].fields.append( - _BATCHUPDATEENTITYTYPESREQUEST.fields_by_name["entity_type_batch_inline"] -) -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name[ - "entity_type_batch_inline" -].containing_oneof = _BATCHUPDATEENTITYTYPESREQUEST.oneofs_by_name["entity_type_batch"] -_BATCHUPDATEENTITYTYPESRESPONSE.fields_by_name[ - "entity_types" -].message_type = _ENTITYTYPE -_BATCHCREATEENTITIESREQUEST.fields_by_name["entities"].message_type = _ENTITYTYPE_ENTITY -_BATCHUPDATEENTITIESREQUEST.fields_by_name["entities"].message_type = _ENTITYTYPE_ENTITY -_BATCHUPDATEENTITIESREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_ENTITYTYPEBATCH.fields_by_name["entity_types"].message_type = _ENTITYTYPE -DESCRIPTOR.message_types_by_name["EntityType"] = _ENTITYTYPE -DESCRIPTOR.message_types_by_name["ListEntityTypesRequest"] = _LISTENTITYTYPESREQUEST -DESCRIPTOR.message_types_by_name["ListEntityTypesResponse"] = _LISTENTITYTYPESRESPONSE -DESCRIPTOR.message_types_by_name["GetEntityTypeRequest"] = _GETENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name["CreateEntityTypeRequest"] = _CREATEENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name["UpdateEntityTypeRequest"] = _UPDATEENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name["DeleteEntityTypeRequest"] = _DELETEENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchUpdateEntityTypesRequest" -] = _BATCHUPDATEENTITYTYPESREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchUpdateEntityTypesResponse" -] = _BATCHUPDATEENTITYTYPESRESPONSE -DESCRIPTOR.message_types_by_name[ - "BatchDeleteEntityTypesRequest" -] = _BATCHDELETEENTITYTYPESREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchCreateEntitiesRequest" -] = _BATCHCREATEENTITIESREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchUpdateEntitiesRequest" -] = _BATCHUPDATEENTITIESREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchDeleteEntitiesRequest" -] = _BATCHDELETEENTITIESREQUEST -DESCRIPTOR.message_types_by_name["EntityTypeBatch"] = _ENTITYTYPEBATCH -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -EntityType = _reflection.GeneratedProtocolMessageType( - "EntityType", - (_message.Message,), - { - "Entity": _reflection.GeneratedProtocolMessageType( - "Entity", - (_message.Message,), - { - "DESCRIPTOR": _ENTITYTYPE_ENTITY, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """An **entity entry** for an associated entity type. - - Attributes: - value: - Required. The primary value associated with this entity entry. - For example, if the entity type is *vegetable*, the value - could be *scallions*. For ``KIND_MAP`` entity types: - A - reference value to be used in place of synonyms. For - ``KIND_LIST`` entity types: - A string that can contain - references to other entity types (with or without aliases). - synonyms: - Required. A collection of value synonyms. For example, if the - entity type is *vegetable*, and ``value`` is *scallions*, a - synonym could be *green onions*. For ``KIND_LIST`` entity - types: - This collection must contain exactly one synonym - equal to ``value``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.EntityType.Entity) - }, - ), - "DESCRIPTOR": _ENTITYTYPE, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """Each intent parameter has a type, called the entity type, which - dictates exactly how data from an end-user expression is extracted. - Dialogflow provides predefined system entities that can match many - common types of data. For example, there are system entities for - matching dates, times, colors, email addresses, and so on. You can - also create your own custom entities for matching custom data. For - example, you could define a vegetable entity that can match the types - of vegetables available for purchase with a grocery store agent. For - more information, see the `Entity guide - `__. - - Attributes: - name: - The unique identifier of the entity type. Required for [Entity - Types.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes - .UpdateEntityType] and [EntityTypes.BatchUpdateEntityTypes][go - ogle.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes] - methods. Format: ``projects//agent/entityTypes/``. - display_name: - Required. The name of the entity type. - kind: - Required. Indicates the kind of entity type. - auto_expansion_mode: - Optional. Indicates whether the entity type can be - automatically expanded. - entities: - Optional. The collection of entity entries associated with the - entity type. - enable_fuzzy_extraction: - Optional. Enables fuzzy entity extraction during - classification. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.EntityType) - }, -) -_sym_db.RegisterMessage(EntityType) -_sym_db.RegisterMessage(EntityType.Entity) - -ListEntityTypesRequest = _reflection.GeneratedProtocolMessageType( - "ListEntityTypesRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTENTITYTYPESREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.ListEntityTypes][google.cloud.dia - logflow.v2.EntityTypes.ListEntityTypes]. - - Attributes: - parent: - Required. The agent to list all entity types from. Format: - ``projects//agent``. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ListEntityTypesRequest) - }, -) -_sym_db.RegisterMessage(ListEntityTypesRequest) - -ListEntityTypesResponse = _reflection.GeneratedProtocolMessageType( - "ListEntityTypesResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTENTITYTYPESRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The response message for [EntityTypes.ListEntityTypes][google.cloud.di - alogflow.v2.EntityTypes.ListEntityTypes]. - - Attributes: - entity_types: - The list of agent entity types. There will be a maximum number - of items returned based on the page_size field in the request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ListEntityTypesResponse) - }, -) -_sym_db.RegisterMessage(ListEntityTypesResponse) - -GetEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "GetEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.GetEntityType][google.cloud.dialo - gflow.v2.EntityTypes.GetEntityType]. - - Attributes: - name: - Required. The name of the entity type. Format: - ``projects//agent/entityTypes/``. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.GetEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(GetEntityTypeRequest) - -CreateEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "CreateEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.CreateEntityType][google.cloud.di - alogflow.v2.EntityTypes.CreateEntityType]. - - Attributes: - parent: - Required. The agent to create a entity type for. Format: - ``projects//agent``. - entity_type: - Required. The entity type to create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.CreateEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(CreateEntityTypeRequest) - -UpdateEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "UpdateEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.UpdateEntityType][google.cloud.di - alogflow.v2.EntityTypes.UpdateEntityType]. - - Attributes: - entity_type: - Required. The entity type to update. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.UpdateEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(UpdateEntityTypeRequest) - -DeleteEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "DeleteEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.DeleteEntityType][google.cloud.di - alogflow.v2.EntityTypes.DeleteEntityType]. - - Attributes: - name: - Required. The name of the entity type to delete. Format: - ``projects//agent/entityTypes/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.DeleteEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(DeleteEntityTypeRequest) - -BatchUpdateEntityTypesRequest = _reflection.GeneratedProtocolMessageType( - "BatchUpdateEntityTypesRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEENTITYTYPESREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.BatchUpdateEntityTypes][google.cl - oud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. - - Attributes: - parent: - Required. The name of the agent to update or create entity - types in. Format: ``projects//agent``. - entity_type_batch: - The source of the entity type batch. For each entity type in - the batch: - If ``name`` is specified, we update an existing - entity type. - If ``name`` is not specified, we create a new - entity type. - entity_type_batch_uri: - The URI to a Google Cloud Storage file containing entity types - to update or create. The file format can either be a - serialized proto (of EntityBatch type) or a JSON object. Note: - The URI must start with “gs://”. - entity_type_batch_inline: - The collection of entity types to update or create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest) - }, -) -_sym_db.RegisterMessage(BatchUpdateEntityTypesRequest) - -BatchUpdateEntityTypesResponse = _reflection.GeneratedProtocolMessageType( - "BatchUpdateEntityTypesResponse", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEENTITYTYPESRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The response message for [EntityTypes.BatchUpdateEntityTypes][google.c - loud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. - - Attributes: - entity_types: - The collection of updated or created entity types. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse) - }, -) -_sym_db.RegisterMessage(BatchUpdateEntityTypesResponse) - -BatchDeleteEntityTypesRequest = _reflection.GeneratedProtocolMessageType( - "BatchDeleteEntityTypesRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHDELETEENTITYTYPESREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.BatchDeleteEntityTypes][google.cl - oud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes]. - - Attributes: - parent: - Required. The name of the agent to delete all entities types - for. Format: ``projects//agent``. - entity_type_names: - Required. The names entity types to delete. All names must - point to the same agent as ``parent``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest) - }, -) -_sym_db.RegisterMessage(BatchDeleteEntityTypesRequest) - -BatchCreateEntitiesRequest = _reflection.GeneratedProtocolMessageType( - "BatchCreateEntitiesRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHCREATEENTITIESREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.BatchCreateEntities][google.cloud - .dialogflow.v2.EntityTypes.BatchCreateEntities]. - - Attributes: - parent: - Required. The name of the entity type to create entities in. - Format: ``projects//agent/entityTypes/``. - entities: - Required. The entities to create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.BatchCreateEntitiesRequest) - }, -) -_sym_db.RegisterMessage(BatchCreateEntitiesRequest) - -BatchUpdateEntitiesRequest = _reflection.GeneratedProtocolMessageType( - "BatchUpdateEntitiesRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEENTITIESREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.BatchUpdateEntities][google.cloud - .dialogflow.v2.EntityTypes.BatchUpdateEntities]. - - Attributes: - parent: - Required. The name of the entity type to update or create - entities in. Format: ``projects//agent/entityTypes/``. - entities: - Required. The entities to update or create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest) - }, -) -_sym_db.RegisterMessage(BatchUpdateEntitiesRequest) - -BatchDeleteEntitiesRequest = _reflection.GeneratedProtocolMessageType( - "BatchDeleteEntitiesRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHDELETEENTITIESREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.BatchDeleteEntities][google.cloud - .dialogflow.v2.EntityTypes.BatchDeleteEntities]. - - Attributes: - parent: - Required. The name of the entity type to delete entries for. - Format: ``projects//agent/entityTypes/``. - entity_values: - Required. The reference ``values`` of the entities to delete. - Note that these are not fully-qualified names, i.e. they don’t - start with ``projects/``. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest) - }, -) -_sym_db.RegisterMessage(BatchDeleteEntitiesRequest) - -EntityTypeBatch = _reflection.GeneratedProtocolMessageType( - "EntityTypeBatch", - (_message.Message,), - { - "DESCRIPTOR": _ENTITYTYPEBATCH, - "__module__": "google.cloud.dialogflow_v2.proto.entity_type_pb2", - "__doc__": """This message is a wrapper around a collection of entity types. - - Attributes: - entity_types: - A collection of entity types. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.EntityTypeBatch) - }, -) -_sym_db.RegisterMessage(EntityTypeBatch) - - -DESCRIPTOR._options = None -_ENTITYTYPE_ENTITY.fields_by_name["value"]._options = None -_ENTITYTYPE_ENTITY.fields_by_name["synonyms"]._options = None -_ENTITYTYPE.fields_by_name["display_name"]._options = None -_ENTITYTYPE.fields_by_name["kind"]._options = None -_ENTITYTYPE.fields_by_name["auto_expansion_mode"]._options = None -_ENTITYTYPE.fields_by_name["entities"]._options = None -_ENTITYTYPE.fields_by_name["enable_fuzzy_extraction"]._options = None -_ENTITYTYPE._options = None -_LISTENTITYTYPESREQUEST.fields_by_name["parent"]._options = None -_LISTENTITYTYPESREQUEST.fields_by_name["language_code"]._options = None -_LISTENTITYTYPESREQUEST.fields_by_name["page_size"]._options = None -_LISTENTITYTYPESREQUEST.fields_by_name["page_token"]._options = None -_GETENTITYTYPEREQUEST.fields_by_name["name"]._options = None -_GETENTITYTYPEREQUEST.fields_by_name["language_code"]._options = None -_CREATEENTITYTYPEREQUEST.fields_by_name["parent"]._options = None -_CREATEENTITYTYPEREQUEST.fields_by_name["entity_type"]._options = None -_CREATEENTITYTYPEREQUEST.fields_by_name["language_code"]._options = None -_UPDATEENTITYTYPEREQUEST.fields_by_name["entity_type"]._options = None -_UPDATEENTITYTYPEREQUEST.fields_by_name["language_code"]._options = None -_UPDATEENTITYTYPEREQUEST.fields_by_name["update_mask"]._options = None -_DELETEENTITYTYPEREQUEST.fields_by_name["name"]._options = None -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name["parent"]._options = None -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name["language_code"]._options = None -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name["update_mask"]._options = None -_BATCHDELETEENTITYTYPESREQUEST.fields_by_name["parent"]._options = None -_BATCHDELETEENTITYTYPESREQUEST.fields_by_name["entity_type_names"]._options = None -_BATCHCREATEENTITIESREQUEST.fields_by_name["parent"]._options = None -_BATCHCREATEENTITIESREQUEST.fields_by_name["entities"]._options = None -_BATCHCREATEENTITIESREQUEST.fields_by_name["language_code"]._options = None -_BATCHUPDATEENTITIESREQUEST.fields_by_name["parent"]._options = None -_BATCHUPDATEENTITIESREQUEST.fields_by_name["entities"]._options = None -_BATCHUPDATEENTITIESREQUEST.fields_by_name["language_code"]._options = None -_BATCHUPDATEENTITIESREQUEST.fields_by_name["update_mask"]._options = None -_BATCHDELETEENTITIESREQUEST.fields_by_name["parent"]._options = None -_BATCHDELETEENTITIESREQUEST.fields_by_name["entity_values"]._options = None -_BATCHDELETEENTITIESREQUEST.fields_by_name["language_code"]._options = None - -_ENTITYTYPES = _descriptor.ServiceDescriptor( - name="EntityTypes", - full_name="google.cloud.dialogflow.v2.EntityTypes", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=2974, - serialized_end=5534, - methods=[ - _descriptor.MethodDescriptor( - name="ListEntityTypes", - full_name="google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes", - index=0, - containing_service=None, - input_type=_LISTENTITYTYPESREQUEST, - output_type=_LISTENTITYTYPESRESPONSE, - serialized_options=b"\202\323\344\223\002+\022)/v2/{parent=projects/*/agent}/entityTypes\332A\006parent\332A\024parent,language_code", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetEntityType", - full_name="google.cloud.dialogflow.v2.EntityTypes.GetEntityType", - index=1, - containing_service=None, - input_type=_GETENTITYTYPEREQUEST, - output_type=_ENTITYTYPE, - serialized_options=b"\202\323\344\223\002+\022)/v2/{name=projects/*/agent/entityTypes/*}\332A\004name\332A\022name,language_code", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateEntityType", - full_name="google.cloud.dialogflow.v2.EntityTypes.CreateEntityType", - index=2, - containing_service=None, - input_type=_CREATEENTITYTYPEREQUEST, - output_type=_ENTITYTYPE, - serialized_options=b'\202\323\344\223\0028")/v2/{parent=projects/*/agent}/entityTypes:\013entity_type\332A\022parent,entity_type\332A parent,entity_type,language_code', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateEntityType", - full_name="google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType", - index=3, - containing_service=None, - input_type=_UPDATEENTITYTYPEREQUEST, - output_type=_ENTITYTYPE, - serialized_options=b"\202\323\344\223\002D25/v2/{entity_type.name=projects/*/agent/entityTypes/*}:\013entity_type\332A\013entity_type\332A\031entity_type,language_code", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteEntityType", - full_name="google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType", - index=4, - containing_service=None, - input_type=_DELETEENTITYTYPEREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002+*)/v2/{name=projects/*/agent/entityTypes/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchUpdateEntityTypes", - full_name="google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes", - index=5, - containing_service=None, - input_type=_BATCHUPDATEENTITYTYPESREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002:"5/v2/{parent=projects/*/agent}/entityTypes:batchUpdate:\001*\312AS\n9google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchDeleteEntityTypes", - full_name="google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes", - index=6, - containing_service=None, - input_type=_BATCHDELETEENTITYTYPESREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002:"5/v2/{parent=projects/*/agent}/entityTypes:batchDelete:\001*\332A\030parent,entity_type_names\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchCreateEntities", - full_name="google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities", - index=7, - containing_service=None, - input_type=_BATCHCREATEENTITIESREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002E"@/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate:\001*\332A\017parent,entities\332A\035parent,entities,language_code\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchUpdateEntities", - full_name="google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities", - index=8, - containing_service=None, - input_type=_BATCHUPDATEENTITIESREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002E"@/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate:\001*\332A\017parent,entities\332A\035parent,entities,language_code\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchDeleteEntities", - full_name="google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities", - index=9, - containing_service=None, - input_type=_BATCHDELETEENTITIESREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002E"@/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete:\001*\332A\024parent,entity_values\332A"parent,entity_values,language_code\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_ENTITYTYPES) - -DESCRIPTOR.services_by_name["EntityTypes"] = _ENTITYTYPES - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2/proto/entity_type_pb2_grpc.py b/dialogflow_v2/proto/entity_type_pb2_grpc.py deleted file mode 100644 index 8b525da51..000000000 --- a/dialogflow_v2/proto/entity_type_pb2_grpc.py +++ /dev/null @@ -1,497 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2.proto import ( - entity_type_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class EntityTypesStub(object): - """Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListEntityTypes = channel.unary_unary( - "/google.cloud.dialogflow.v2.EntityTypes/ListEntityTypes", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.ListEntityTypesRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.ListEntityTypesResponse.FromString, - ) - self.GetEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2.EntityTypes/GetEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.GetEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.EntityType.FromString, - ) - self.CreateEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2.EntityTypes/CreateEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.CreateEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.EntityType.FromString, - ) - self.UpdateEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2.EntityTypes/UpdateEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.UpdateEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.EntityType.FromString, - ) - self.DeleteEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2.EntityTypes/DeleteEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.DeleteEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.BatchUpdateEntityTypes = channel.unary_unary( - "/google.cloud.dialogflow.v2.EntityTypes/BatchUpdateEntityTypes", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchUpdateEntityTypesRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.BatchDeleteEntityTypes = channel.unary_unary( - "/google.cloud.dialogflow.v2.EntityTypes/BatchDeleteEntityTypes", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchDeleteEntityTypesRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.BatchCreateEntities = channel.unary_unary( - "/google.cloud.dialogflow.v2.EntityTypes/BatchCreateEntities", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchCreateEntitiesRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.BatchUpdateEntities = channel.unary_unary( - "/google.cloud.dialogflow.v2.EntityTypes/BatchUpdateEntities", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchUpdateEntitiesRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.BatchDeleteEntities = channel.unary_unary( - "/google.cloud.dialogflow.v2.EntityTypes/BatchDeleteEntities", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchDeleteEntitiesRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - - -class EntityTypesServicer(object): - """Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType]. - """ - - def ListEntityTypes(self, request, context): - """Returns the list of all entity types in the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetEntityType(self, request, context): - """Retrieves the specified entity type. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateEntityType(self, request, context): - """Creates an entity type in the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateEntityType(self, request, context): - """Updates the specified entity type. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteEntityType(self, request, context): - """Deletes the specified entity type. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchUpdateEntityTypes(self, request, context): - """Updates/Creates multiple entity types in the specified agent. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchDeleteEntityTypes(self, request, context): - """Deletes entity types in the specified agent. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchCreateEntities(self, request, context): - """Creates multiple new entities in the specified entity type. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchUpdateEntities(self, request, context): - """Updates or creates multiple entities in the specified entity type. This - method does not affect entities in the entity type that aren't explicitly - specified in the request. - - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchDeleteEntities(self, request, context): - """Deletes entities in the specified entity type. - - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_EntityTypesServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListEntityTypes": grpc.unary_unary_rpc_method_handler( - servicer.ListEntityTypes, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.ListEntityTypesRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.ListEntityTypesResponse.SerializeToString, - ), - "GetEntityType": grpc.unary_unary_rpc_method_handler( - servicer.GetEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.GetEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.EntityType.SerializeToString, - ), - "CreateEntityType": grpc.unary_unary_rpc_method_handler( - servicer.CreateEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.CreateEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.EntityType.SerializeToString, - ), - "UpdateEntityType": grpc.unary_unary_rpc_method_handler( - servicer.UpdateEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.UpdateEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.EntityType.SerializeToString, - ), - "DeleteEntityType": grpc.unary_unary_rpc_method_handler( - servicer.DeleteEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.DeleteEntityTypeRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "BatchUpdateEntityTypes": grpc.unary_unary_rpc_method_handler( - servicer.BatchUpdateEntityTypes, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchUpdateEntityTypesRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "BatchDeleteEntityTypes": grpc.unary_unary_rpc_method_handler( - servicer.BatchDeleteEntityTypes, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchDeleteEntityTypesRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "BatchCreateEntities": grpc.unary_unary_rpc_method_handler( - servicer.BatchCreateEntities, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchCreateEntitiesRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "BatchUpdateEntities": grpc.unary_unary_rpc_method_handler( - servicer.BatchUpdateEntities, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchUpdateEntitiesRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "BatchDeleteEntities": grpc.unary_unary_rpc_method_handler( - servicer.BatchDeleteEntities, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchDeleteEntitiesRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2.EntityTypes", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class EntityTypes(object): - """Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType]. - """ - - @staticmethod - def ListEntityTypes( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.EntityTypes/ListEntityTypes", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.ListEntityTypesRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.ListEntityTypesResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.EntityTypes/GetEntityType", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.GetEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.EntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.EntityTypes/CreateEntityType", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.CreateEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.EntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.EntityTypes/UpdateEntityType", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.UpdateEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.EntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.EntityTypes/DeleteEntityType", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.DeleteEntityTypeRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchUpdateEntityTypes( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.EntityTypes/BatchUpdateEntityTypes", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchUpdateEntityTypesRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchDeleteEntityTypes( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.EntityTypes/BatchDeleteEntityTypes", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchDeleteEntityTypesRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchCreateEntities( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.EntityTypes/BatchCreateEntities", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchCreateEntitiesRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchUpdateEntities( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.EntityTypes/BatchUpdateEntities", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchUpdateEntitiesRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchDeleteEntities( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.EntityTypes/BatchDeleteEntities", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.BatchDeleteEntitiesRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2/proto/environment_pb2.py b/dialogflow_v2/proto/environment_pb2.py deleted file mode 100644 index fedb92683..000000000 --- a/dialogflow_v2/proto/environment_pb2.py +++ /dev/null @@ -1,486 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2/proto/environment.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2/proto/environment.proto", - package="google.cloud.dialogflow.v2", - syntax="proto3", - serialized_options=b"\n\036com.google.cloud.dialogflow.v2B\020EnvironmentProtoP\001ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cloud.Dialogflow.V2", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n2google/cloud/dialogflow_v2/proto/environment.proto\x12\x1agoogle.cloud.dialogflow.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/api/client.proto"\xf7\x02\n\x0b\x45nvironment\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x18\n\x0b\x64\x65scription\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x1a\n\ragent_version\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x41\n\x05state\x18\x04 \x01(\x0e\x32-.google.cloud.dialogflow.v2.Environment.StateB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03"E\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07STOPPED\x10\x01\x12\x0b\n\x07LOADING\x10\x02\x12\x0b\n\x07RUNNING\x10\x03:_\xea\x41\\\n%dialogflow.googleapis.com/Environment\x12\x33projects/{project}/agent/environments/{environment}"\x89\x01\n\x17ListEnvironmentsRequest\x12=\n\x06parent\x18\x01 \x01(\tB-\xe0\x41\x02\xfa\x41\'\x12%dialogflow.googleapis.com/Environment\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01"r\n\x18ListEnvironmentsResponse\x12=\n\x0c\x65nvironments\x18\x01 \x03(\x0b\x32\'.google.cloud.dialogflow.v2.Environment\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t2\xbc\x02\n\x0c\x45nvironments\x12\xb1\x01\n\x10ListEnvironments\x12\x33.google.cloud.dialogflow.v2.ListEnvironmentsRequest\x1a\x34.google.cloud.dialogflow.v2.ListEnvironmentsResponse"2\x82\xd3\xe4\x93\x02,\x12*/v2/{parent=projects/*/agent}/environments\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\x9f\x01\n\x1e\x63om.google.cloud.dialogflow.v2B\x10\x45nvironmentProtoP\x01ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1aGoogle.Cloud.Dialogflow.V2b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - ], -) - - -_ENVIRONMENT_STATE = _descriptor.EnumDescriptor( - name="State", - full_name="google.cloud.dialogflow.v2.Environment.State", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="STATE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="STOPPED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LOADING", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="RUNNING", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=503, - serialized_end=572, -) -_sym_db.RegisterEnumDescriptor(_ENVIRONMENT_STATE) - - -_ENVIRONMENT = _descriptor.Descriptor( - name="Environment", - full_name="google.cloud.dialogflow.v2.Environment", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.Environment.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2.Environment.description", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_version", - full_name="google.cloud.dialogflow.v2.Environment.agent_version", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="state", - full_name="google.cloud.dialogflow.v2.Environment.state", - index=3, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_time", - full_name="google.cloud.dialogflow.v2.Environment.update_time", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_ENVIRONMENT_STATE], - serialized_options=b"\352A\\\n%dialogflow.googleapis.com/Environment\0223projects/{project}/agent/environments/{environment}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=294, - serialized_end=669, -) - - -_LISTENVIRONMENTSREQUEST = _descriptor.Descriptor( - name="ListEnvironmentsRequest", - full_name="google.cloud.dialogflow.v2.ListEnvironmentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.ListEnvironmentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A'\022%dialogflow.googleapis.com/Environment", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2.ListEnvironmentsRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2.ListEnvironmentsRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=672, - serialized_end=809, -) - - -_LISTENVIRONMENTSRESPONSE = _descriptor.Descriptor( - name="ListEnvironmentsResponse", - full_name="google.cloud.dialogflow.v2.ListEnvironmentsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="environments", - full_name="google.cloud.dialogflow.v2.ListEnvironmentsResponse.environments", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2.ListEnvironmentsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=811, - serialized_end=925, -) - -_ENVIRONMENT.fields_by_name["state"].enum_type = _ENVIRONMENT_STATE -_ENVIRONMENT.fields_by_name[ - "update_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_ENVIRONMENT_STATE.containing_type = _ENVIRONMENT -_LISTENVIRONMENTSRESPONSE.fields_by_name["environments"].message_type = _ENVIRONMENT -DESCRIPTOR.message_types_by_name["Environment"] = _ENVIRONMENT -DESCRIPTOR.message_types_by_name["ListEnvironmentsRequest"] = _LISTENVIRONMENTSREQUEST -DESCRIPTOR.message_types_by_name["ListEnvironmentsResponse"] = _LISTENVIRONMENTSRESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Environment = _reflection.GeneratedProtocolMessageType( - "Environment", - (_message.Message,), - { - "DESCRIPTOR": _ENVIRONMENT, - "__module__": "google.cloud.dialogflow_v2.proto.environment_pb2", - "__doc__": """You can create multiple versions of your agent and publish them to - separate environments. When you edit an agent, you are editing the - draft agent. At any point, you can save the draft agent as an agent - version, which is an immutable snapshot of your agent. When you save - the draft agent, it is published to the default environment. When you - create agent versions, you can publish them to custom environments. - You can create a variety of custom environments for: - testing - - development - production - etc. For more information, see the - `versions and environments guide - `__. - - Attributes: - name: - Output only. The unique identifier of this agent environment. - Format: ``projects//agent/environments/``. For Environment ID, - “-” is reserved for ‘draft’ environment. - description: - Optional. The developer-provided description for this - environment. The maximum length is 500 characters. If - exceeded, the request is rejected. - agent_version: - Optional. The agent version loaded into this environment. - Format: ``projects//agent/versions/``. - state: - Output only. The state of this environment. This field is - read-only, i.e., it cannot be set by create and update - methods. - update_time: - Output only. The last update time of this environment. This - field is read-only, i.e., it cannot be set by create and - update methods. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Environment) - }, -) -_sym_db.RegisterMessage(Environment) - -ListEnvironmentsRequest = _reflection.GeneratedProtocolMessageType( - "ListEnvironmentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTENVIRONMENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.environment_pb2", - "__doc__": """The request message for [Environments.ListEnvironments][google.cloud.d - ialogflow.v2.Environments.ListEnvironments]. - - Attributes: - parent: - Required. The agent to list all environments from. Format: - ``projects//agent``. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ListEnvironmentsRequest) - }, -) -_sym_db.RegisterMessage(ListEnvironmentsRequest) - -ListEnvironmentsResponse = _reflection.GeneratedProtocolMessageType( - "ListEnvironmentsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTENVIRONMENTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.environment_pb2", - "__doc__": """The response message for [Environments.ListEnvironments][google.cloud. - dialogflow.v2.Environments.ListEnvironments]. - - Attributes: - environments: - The list of agent environments. There will be a maximum number - of items returned based on the page_size field in the request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ListEnvironmentsResponse) - }, -) -_sym_db.RegisterMessage(ListEnvironmentsResponse) - - -DESCRIPTOR._options = None -_ENVIRONMENT.fields_by_name["name"]._options = None -_ENVIRONMENT.fields_by_name["description"]._options = None -_ENVIRONMENT.fields_by_name["agent_version"]._options = None -_ENVIRONMENT.fields_by_name["state"]._options = None -_ENVIRONMENT.fields_by_name["update_time"]._options = None -_ENVIRONMENT._options = None -_LISTENVIRONMENTSREQUEST.fields_by_name["parent"]._options = None -_LISTENVIRONMENTSREQUEST.fields_by_name["page_size"]._options = None -_LISTENVIRONMENTSREQUEST.fields_by_name["page_token"]._options = None - -_ENVIRONMENTS = _descriptor.ServiceDescriptor( - name="Environments", - full_name="google.cloud.dialogflow.v2.Environments", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=928, - serialized_end=1244, - methods=[ - _descriptor.MethodDescriptor( - name="ListEnvironments", - full_name="google.cloud.dialogflow.v2.Environments.ListEnvironments", - index=0, - containing_service=None, - input_type=_LISTENVIRONMENTSREQUEST, - output_type=_LISTENVIRONMENTSRESPONSE, - serialized_options=b"\202\323\344\223\002,\022*/v2/{parent=projects/*/agent}/environments", - create_key=_descriptor._internal_create_key, - ) - ], -) -_sym_db.RegisterServiceDescriptor(_ENVIRONMENTS) - -DESCRIPTOR.services_by_name["Environments"] = _ENVIRONMENTS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2/proto/environment_pb2_grpc.py b/dialogflow_v2/proto/environment_pb2_grpc.py deleted file mode 100644 index 83ede9765..000000000 --- a/dialogflow_v2/proto/environment_pb2_grpc.py +++ /dev/null @@ -1,83 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2.proto import ( - environment_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_environment__pb2, -) - - -class EnvironmentsStub(object): - """Service for managing [Environments][google.cloud.dialogflow.v2.Environment]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListEnvironments = channel.unary_unary( - "/google.cloud.dialogflow.v2.Environments/ListEnvironments", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_environment__pb2.ListEnvironmentsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_environment__pb2.ListEnvironmentsResponse.FromString, - ) - - -class EnvironmentsServicer(object): - """Service for managing [Environments][google.cloud.dialogflow.v2.Environment]. - """ - - def ListEnvironments(self, request, context): - """Returns the list of all non-draft environments of the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_EnvironmentsServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListEnvironments": grpc.unary_unary_rpc_method_handler( - servicer.ListEnvironments, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_environment__pb2.ListEnvironmentsRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_environment__pb2.ListEnvironmentsResponse.SerializeToString, - ) - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2.Environments", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Environments(object): - """Service for managing [Environments][google.cloud.dialogflow.v2.Environment]. - """ - - @staticmethod - def ListEnvironments( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Environments/ListEnvironments", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_environment__pb2.ListEnvironmentsRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_environment__pb2.ListEnvironmentsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2/proto/intent_pb2.py b/dialogflow_v2/proto/intent_pb2.py deleted file mode 100644 index ea77470de..000000000 --- a/dialogflow_v2/proto/intent_pb2.py +++ /dev/null @@ -1,5837 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2/proto/intent.proto -"""Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from dialogflow_v2.proto import ( - audio_config_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_audio__config__pb2, -) -from dialogflow_v2.proto import ( - context_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2/proto/intent.proto", - package="google.cloud.dialogflow.v2", - syntax="proto3", - serialized_options=b"\n\036com.google.cloud.dialogflow.v2B\013IntentProtoP\001ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cloud.Dialogflow.V2", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n-google/cloud/dialogflow_v2/proto/intent.proto\x12\x1agoogle.cloud.dialogflow.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x33google/cloud/dialogflow_v2/proto/audio_config.proto\x1a.google/cloud/dialogflow_v2/proto/context.proto\x1a#google/longrunning/operations.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/protobuf/struct.proto"\xcc\x37\n\x06Intent\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12K\n\rwebhook_state\x18\x06 \x01(\x0e\x32/.google.cloud.dialogflow.v2.Intent.WebhookStateB\x03\xe0\x41\x01\x12\x15\n\x08priority\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x18\n\x0bis_fallback\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x12\x18\n\x0bml_disabled\x18\x13 \x01(\x08\x42\x03\xe0\x41\x01\x12 \n\x13input_context_names\x18\x07 \x03(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x65vents\x18\x08 \x03(\tB\x03\xe0\x41\x01\x12P\n\x10training_phrases\x18\t \x03(\x0b\x32\x31.google.cloud.dialogflow.v2.Intent.TrainingPhraseB\x03\xe0\x41\x01\x12\x13\n\x06\x61\x63tion\x18\n \x01(\tB\x03\xe0\x41\x01\x12\x41\n\x0foutput_contexts\x18\x0b \x03(\x0b\x32#.google.cloud.dialogflow.v2.ContextB\x03\xe0\x41\x01\x12\x1b\n\x0ereset_contexts\x18\x0c \x01(\x08\x42\x03\xe0\x41\x01\x12\x45\n\nparameters\x18\r \x03(\x0b\x32,.google.cloud.dialogflow.v2.Intent.ParameterB\x03\xe0\x41\x01\x12\x41\n\x08messages\x18\x0e \x03(\x0b\x32*.google.cloud.dialogflow.v2.Intent.MessageB\x03\xe0\x41\x01\x12\\\n\x1a\x64\x65\x66\x61ult_response_platforms\x18\x0f \x03(\x0e\x32\x33.google.cloud.dialogflow.v2.Intent.Message.PlatformB\x03\xe0\x41\x01\x12!\n\x19root_followup_intent_name\x18\x10 \x01(\t\x12#\n\x1bparent_followup_intent_name\x18\x11 \x01(\t\x12S\n\x14\x66ollowup_intent_info\x18\x12 \x03(\x0b\x32\x35.google.cloud.dialogflow.v2.Intent.FollowupIntentInfo\x1a\xf1\x02\n\x0eTrainingPhrase\x12\x0c\n\x04name\x18\x01 \x01(\t\x12I\n\x04type\x18\x02 \x01(\x0e\x32\x36.google.cloud.dialogflow.v2.Intent.TrainingPhrase.TypeB\x03\xe0\x41\x02\x12J\n\x05parts\x18\x03 \x03(\x0b\x32\x36.google.cloud.dialogflow.v2.Intent.TrainingPhrase.PartB\x03\xe0\x41\x02\x12\x1e\n\x11times_added_count\x18\x04 \x01(\x05\x42\x03\xe0\x41\x01\x1a]\n\x04Part\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x18\n\x0b\x65ntity_type\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x12\n\x05\x61lias\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x19\n\x0cuser_defined\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01";\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x45XAMPLE\x10\x01\x12\x10\n\x08TEMPLATE\x10\x02\x1a\x02\x08\x01\x1a\xca\x01\n\tParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x12\n\x05value\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x1a\n\rdefault_value\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12%\n\x18\x65ntity_type_display_name\x18\x05 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\tmandatory\x18\x06 \x01(\x08\x42\x03\xe0\x41\x01\x12\x14\n\x07prompts\x18\x07 \x03(\tB\x03\xe0\x41\x01\x12\x14\n\x07is_list\x18\x08 \x01(\x08\x42\x03\xe0\x41\x01\x1a\x96*\n\x07Message\x12?\n\x04text\x18\x01 \x01(\x0b\x32/.google.cloud.dialogflow.v2.Intent.Message.TextH\x00\x12\x41\n\x05image\x18\x02 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2.Intent.Message.ImageH\x00\x12P\n\rquick_replies\x18\x03 \x01(\x0b\x32\x37.google.cloud.dialogflow.v2.Intent.Message.QuickRepliesH\x00\x12?\n\x04\x63\x61rd\x18\x04 \x01(\x0b\x32/.google.cloud.dialogflow.v2.Intent.Message.CardH\x00\x12*\n\x07payload\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12V\n\x10simple_responses\x18\x07 \x01(\x0b\x32:.google.cloud.dialogflow.v2.Intent.Message.SimpleResponsesH\x00\x12J\n\nbasic_card\x18\x08 \x01(\x0b\x32\x34.google.cloud.dialogflow.v2.Intent.Message.BasicCardH\x00\x12M\n\x0bsuggestions\x18\t \x01(\x0b\x32\x36.google.cloud.dialogflow.v2.Intent.Message.SuggestionsH\x00\x12[\n\x13link_out_suggestion\x18\n \x01(\x0b\x32<.google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestionH\x00\x12L\n\x0blist_select\x18\x0b \x01(\x0b\x32\x35.google.cloud.dialogflow.v2.Intent.Message.ListSelectH\x00\x12T\n\x0f\x63\x61rousel_select\x18\x0c \x01(\x0b\x32\x39.google.cloud.dialogflow.v2.Intent.Message.CarouselSelectH\x00\x12]\n\x14\x62rowse_carousel_card\x18\x16 \x01(\x0b\x32=.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCardH\x00\x12J\n\ntable_card\x18\x17 \x01(\x0b\x32\x34.google.cloud.dialogflow.v2.Intent.Message.TableCardH\x00\x12P\n\rmedia_content\x18\x18 \x01(\x0b\x32\x37.google.cloud.dialogflow.v2.Intent.Message.MediaContentH\x00\x12J\n\x08platform\x18\x06 \x01(\x0e\x32\x33.google.cloud.dialogflow.v2.Intent.Message.PlatformB\x03\xe0\x41\x01\x1a\x19\n\x04Text\x12\x11\n\x04text\x18\x01 \x03(\tB\x03\xe0\x41\x01\x1a@\n\x05Image\x12\x16\n\timage_uri\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x1f\n\x12\x61\x63\x63\x65ssibility_text\x18\x02 \x01(\tB\x03\xe0\x41\x01\x1a>\n\x0cQuickReplies\x12\x12\n\x05title\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x1a\n\rquick_replies\x18\x02 \x03(\tB\x03\xe0\x41\x01\x1a\xcb\x01\n\x04\x43\x61rd\x12\x12\n\x05title\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08subtitle\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\timage_uri\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12L\n\x07\x62uttons\x18\x04 \x03(\x0b\x32\x36.google.cloud.dialogflow.v2.Intent.Message.Card.ButtonB\x03\xe0\x41\x01\x1a\x32\n\x06\x42utton\x12\x11\n\x04text\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08postback\x18\x02 \x01(\tB\x03\xe0\x41\x01\x1aQ\n\x0eSimpleResponse\x12\x16\n\x0etext_to_speech\x18\x01 \x01(\t\x12\x0c\n\x04ssml\x18\x02 \x01(\t\x12\x19\n\x0c\x64isplay_text\x18\x03 \x01(\tB\x03\xe0\x41\x01\x1ak\n\x0fSimpleResponses\x12X\n\x10simple_responses\x18\x01 \x03(\x0b\x32\x39.google.cloud.dialogflow.v2.Intent.Message.SimpleResponseB\x03\xe0\x41\x02\x1a\x88\x03\n\tBasicCard\x12\x12\n\x05title\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08subtitle\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\x0e\x66ormatted_text\x18\x03 \x01(\t\x12\x44\n\x05image\x18\x04 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2.Intent.Message.ImageB\x03\xe0\x41\x01\x12Q\n\x07\x62uttons\x18\x05 \x03(\x0b\x32;.google.cloud.dialogflow.v2.Intent.Message.BasicCard.ButtonB\x03\xe0\x41\x01\x1a\x9e\x01\n\x06\x42utton\x12\r\n\x05title\x18\x01 \x01(\t\x12g\n\x0fopen_uri_action\x18\x02 \x01(\x0b\x32I.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriActionB\x03\xe0\x41\x02\x1a\x1c\n\rOpenUriAction\x12\x0b\n\x03uri\x18\x01 \x01(\t\x1a \n\nSuggestion\x12\x12\n\x05title\x18\x01 \x01(\tB\x03\xe0\x41\x02\x1a^\n\x0bSuggestions\x12O\n\x0bsuggestions\x18\x01 \x03(\x0b\x32\x35.google.cloud.dialogflow.v2.Intent.Message.SuggestionB\x03\xe0\x41\x02\x1a\x44\n\x11LinkOutSuggestion\x12\x1d\n\x10\x64\x65stination_name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x10\n\x03uri\x18\x02 \x01(\tB\x03\xe0\x41\x02\x1a\xd2\x02\n\nListSelect\x12\x12\n\x05title\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12N\n\x05items\x18\x02 \x03(\x0b\x32:.google.cloud.dialogflow.v2.Intent.Message.ListSelect.ItemB\x03\xe0\x41\x02\x12\x15\n\x08subtitle\x18\x03 \x01(\tB\x03\xe0\x41\x01\x1a\xc8\x01\n\x04Item\x12L\n\x04info\x18\x01 \x01(\x0b\x32\x39.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfoB\x03\xe0\x41\x02\x12\x12\n\x05title\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x0b\x64\x65scription\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x44\n\x05image\x18\x04 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2.Intent.Message.ImageB\x03\xe0\x41\x01\x1a\xaf\x02\n\x0e\x43\x61rouselSelect\x12R\n\x05items\x18\x01 \x03(\x0b\x32>.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.ItemB\x03\xe0\x41\x02\x1a\xc8\x01\n\x04Item\x12L\n\x04info\x18\x01 \x01(\x0b\x32\x39.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfoB\x03\xe0\x41\x02\x12\x12\n\x05title\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x0b\x64\x65scription\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x44\n\x05image\x18\x04 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2.Intent.Message.ImageB\x03\xe0\x41\x01\x1a\x39\n\x0eSelectItemInfo\x12\x10\n\x03key\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x15\n\x08synonyms\x18\x02 \x03(\tB\x03\xe0\x41\x01\x1a\x8e\x04\n\x0cMediaContent\x12\x62\n\nmedia_type\x18\x01 \x01(\x0e\x32I.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaTypeB\x03\xe0\x41\x01\x12\x62\n\rmedia_objects\x18\x02 \x03(\x0b\x32K.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject\x1a\xf0\x01\n\x13ResponseMediaObject\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x18\n\x0b\x64\x65scription\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12L\n\x0blarge_image\x18\x03 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2.Intent.Message.ImageB\x03\xe0\x41\x01H\x00\x12\x45\n\x04icon\x18\x04 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2.Intent.Message.ImageB\x03\xe0\x41\x01H\x00\x12\x13\n\x0b\x63ontent_url\x18\x05 \x01(\tB\x07\n\x05image"C\n\x11ResponseMediaType\x12#\n\x1fRESPONSE_MEDIA_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05\x41UDIO\x10\x01\x1a\xff\x06\n\x12\x42rowseCarouselCard\x12\x63\n\x05items\x18\x01 \x03(\x0b\x32T.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem\x12u\n\x15image_display_options\x18\x02 \x01(\x0e\x32Q.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptionsB\x03\xe0\x41\x01\x1a\x94\x04\n\x16\x42rowseCarouselCardItem\x12{\n\x0fopen_uri_action\x18\x01 \x01(\x0b\x32\x62.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction\x12\r\n\x05title\x18\x02 \x01(\t\x12\x18\n\x0b\x64\x65scription\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x44\n\x05image\x18\x04 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2.Intent.Message.ImageB\x03\xe0\x41\x01\x12\x13\n\x06\x66ooter\x18\x05 \x01(\tB\x03\xe0\x41\x01\x1a\xf8\x01\n\rOpenUrlAction\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x8a\x01\n\rurl_type_hint\x18\x03 \x01(\x0e\x32n.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHintB\x03\xe0\x41\x01"M\n\x0bUrlTypeHint\x12\x1d\n\x19URL_TYPE_HINT_UNSPECIFIED\x10\x00\x12\x0e\n\nAMP_ACTION\x10\x01\x12\x0f\n\x0b\x41MP_CONTENT\x10\x02"v\n\x13ImageDisplayOptions\x12%\n!IMAGE_DISPLAY_OPTIONS_UNSPECIFIED\x10\x00\x12\x08\n\x04GRAY\x10\x01\x12\t\n\x05WHITE\x10\x02\x12\x0b\n\x07\x43ROPPED\x10\x03\x12\x16\n\x12\x42LURRED_BACKGROUND\x10\x04\x1a\xf3\x02\n\tTableCard\x12\r\n\x05title\x18\x01 \x01(\t\x12\x15\n\x08subtitle\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x44\n\x05image\x18\x03 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2.Intent.Message.ImageB\x03\xe0\x41\x01\x12[\n\x11\x63olumn_properties\x18\x04 \x03(\x0b\x32;.google.cloud.dialogflow.v2.Intent.Message.ColumnPropertiesB\x03\xe0\x41\x01\x12J\n\x04rows\x18\x05 \x03(\x0b\x32\x37.google.cloud.dialogflow.v2.Intent.Message.TableCardRowB\x03\xe0\x41\x01\x12Q\n\x07\x62uttons\x18\x06 \x03(\x0b\x32;.google.cloud.dialogflow.v2.Intent.Message.BasicCard.ButtonB\x03\xe0\x41\x01\x1a\xfa\x01\n\x10\x43olumnProperties\x12\x0e\n\x06header\x18\x01 \x01(\t\x12r\n\x14horizontal_alignment\x18\x02 \x01(\x0e\x32O.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignmentB\x03\xe0\x41\x01"b\n\x13HorizontalAlignment\x12$\n HORIZONTAL_ALIGNMENT_UNSPECIFIED\x10\x00\x12\x0b\n\x07LEADING\x10\x01\x12\n\n\x06\x43\x45NTER\x10\x02\x12\x0c\n\x08TRAILING\x10\x03\x1ax\n\x0cTableCardRow\x12L\n\x05\x63\x65lls\x18\x01 \x03(\x0b\x32\x38.google.cloud.dialogflow.v2.Intent.Message.TableCardCellB\x03\xe0\x41\x01\x12\x1a\n\rdivider_after\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x1a\x1d\n\rTableCardCell\x12\x0c\n\x04text\x18\x01 \x01(\t"\xa0\x01\n\x08Platform\x12\x18\n\x14PLATFORM_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x46\x41\x43\x45\x42OOK\x10\x01\x12\t\n\x05SLACK\x10\x02\x12\x0c\n\x08TELEGRAM\x10\x03\x12\x07\n\x03KIK\x10\x04\x12\t\n\x05SKYPE\x10\x05\x12\x08\n\x04LINE\x10\x06\x12\t\n\x05VIBER\x10\x07\x12\x15\n\x11\x41\x43TIONS_ON_GOOGLE\x10\x08\x12\x13\n\x0fGOOGLE_HANGOUTS\x10\x0b\x42\t\n\x07message\x1aW\n\x12\x46ollowupIntentInfo\x12\x1c\n\x14\x66ollowup_intent_name\x18\x01 \x01(\t\x12#\n\x1bparent_followup_intent_name\x18\x02 \x01(\t"t\n\x0cWebhookState\x12\x1d\n\x19WEBHOOK_STATE_UNSPECIFIED\x10\x00\x12\x19\n\x15WEBHOOK_STATE_ENABLED\x10\x01\x12*\n&WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING\x10\x02:P\xea\x41M\n dialogflow.googleapis.com/Intent\x12)projects/{project}/agent/intents/{intent}"\xdd\x01\n\x12ListIntentsRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\x12 dialogflow.googleapis.com/Intent\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12@\n\x0bintent_view\x18\x03 \x01(\x0e\x32&.google.cloud.dialogflow.v2.IntentViewB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x04 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x05 \x01(\tB\x03\xe0\x41\x01"c\n\x13ListIntentsResponse\x12\x33\n\x07intents\x18\x01 \x03(\x0b\x32".google.cloud.dialogflow.v2.Intent\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\xa8\x01\n\x10GetIntentRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n dialogflow.googleapis.com/Intent\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12@\n\x0bintent_view\x18\x03 \x01(\x0e\x32&.google.cloud.dialogflow.v2.IntentViewB\x03\xe0\x41\x01"\xe6\x01\n\x13\x43reateIntentRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\x12 dialogflow.googleapis.com/Intent\x12\x37\n\x06intent\x18\x02 \x01(\x0b\x32".google.cloud.dialogflow.v2.IntentB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12@\n\x0bintent_view\x18\x04 \x01(\x0e\x32&.google.cloud.dialogflow.v2.IntentViewB\x03\xe0\x41\x01"\xe2\x01\n\x13UpdateIntentRequest\x12\x37\n\x06intent\x18\x01 \x01(\x0b\x32".google.cloud.dialogflow.v2.IntentB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x34\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\x12@\n\x0bintent_view\x18\x04 \x01(\x0e\x32&.google.cloud.dialogflow.v2.IntentViewB\x03\xe0\x41\x01"M\n\x13\x44\x65leteIntentRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n dialogflow.googleapis.com/Intent"\xdd\x02\n\x19\x42\x61tchUpdateIntentsRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\x12 dialogflow.googleapis.com/Intent\x12\x1a\n\x10intent_batch_uri\x18\x02 \x01(\tH\x00\x12\x46\n\x13intent_batch_inline\x18\x03 \x01(\x0b\x32\'.google.cloud.dialogflow.v2.IntentBatchH\x00\x12\x1a\n\rlanguage_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x34\n\x0bupdate_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\x12@\n\x0bintent_view\x18\x06 \x01(\x0e\x32&.google.cloud.dialogflow.v2.IntentViewB\x03\xe0\x41\x01\x42\x0e\n\x0cintent_batch"Q\n\x1a\x42\x61tchUpdateIntentsResponse\x12\x33\n\x07intents\x18\x01 \x03(\x0b\x32".google.cloud.dialogflow.v2.Intent"\x8f\x01\n\x19\x42\x61tchDeleteIntentsRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\x12 dialogflow.googleapis.com/Intent\x12\x38\n\x07intents\x18\x02 \x03(\x0b\x32".google.cloud.dialogflow.v2.IntentB\x03\xe0\x41\x02"B\n\x0bIntentBatch\x12\x33\n\x07intents\x18\x01 \x03(\x0b\x32".google.cloud.dialogflow.v2.Intent*?\n\nIntentView\x12\x1b\n\x17INTENT_VIEW_UNSPECIFIED\x10\x00\x12\x14\n\x10INTENT_VIEW_FULL\x10\x01\x32\xca\x0c\n\x07Intents\x12\xbd\x01\n\x0bListIntents\x12..google.cloud.dialogflow.v2.ListIntentsRequest\x1a/.google.cloud.dialogflow.v2.ListIntentsResponse"M\x82\xd3\xe4\x93\x02\'\x12%/v2/{parent=projects/*/agent}/intents\xda\x41\x06parent\xda\x41\x14parent,language_code\x12\xa8\x01\n\tGetIntent\x12,.google.cloud.dialogflow.v2.GetIntentRequest\x1a".google.cloud.dialogflow.v2.Intent"I\x82\xd3\xe4\x93\x02\'\x12%/v2/{name=projects/*/agent/intents/*}\xda\x41\x04name\xda\x41\x12name,language_code\x12\xc8\x01\n\x0c\x43reateIntent\x12/.google.cloud.dialogflow.v2.CreateIntentRequest\x1a".google.cloud.dialogflow.v2.Intent"c\x82\xd3\xe4\x93\x02/"%/v2/{parent=projects/*/agent}/intents:\x06intent\xda\x41\rparent,intent\xda\x41\x1bparent,intent,language_code\x12\xdb\x01\n\x0cUpdateIntent\x12/.google.cloud.dialogflow.v2.UpdateIntentRequest\x1a".google.cloud.dialogflow.v2.Intent"v\x82\xd3\xe4\x93\x02\x36\x32,/v2/{intent.name=projects/*/agent/intents/*}:\x06intent\xda\x41\x14intent,language_code\xda\x41 intent,language_code,update_mask\x12\x8d\x01\n\x0c\x44\x65leteIntent\x12/.google.cloud.dialogflow.v2.DeleteIntentRequest\x1a\x16.google.protobuf.Empty"4\x82\xd3\xe4\x93\x02\'*%/v2/{name=projects/*/agent/intents/*}\xda\x41\x04name\x12\xb2\x02\n\x12\x42\x61tchUpdateIntents\x12\x35.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest\x1a\x1d.google.longrunning.Operation"\xc5\x01\x82\xd3\xe4\x93\x02\x36"1/v2/{parent=projects/*/agent}/intents:batchUpdate:\x01*\xda\x41\x17parent,intent_batch_uri\xda\x41\x1aparent,intent_batch_inline\xca\x41O\n5google.cloud.dialogflow.v2.BatchUpdateIntentsResponse\x12\x16google.protobuf.Struct\x12\xeb\x01\n\x12\x42\x61tchDeleteIntents\x12\x35.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest\x1a\x1d.google.longrunning.Operation"\x7f\x82\xd3\xe4\x93\x02\x36"1/v2/{parent=projects/*/agent}/intents:batchDelete:\x01*\xda\x41\x0eparent,intents\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\x9a\x01\n\x1e\x63om.google.cloud.dialogflow.v2B\x0bIntentProtoP\x01ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1aGoogle.Cloud.Dialogflow.V2b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_audio__config__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.DESCRIPTOR, - google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, - google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, - ], -) - -_INTENTVIEW = _descriptor.EnumDescriptor( - name="IntentView", - full_name="google.cloud.dialogflow.v2.IntentView", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="INTENT_VIEW_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INTENT_VIEW_FULL", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=9260, - serialized_end=9323, -) -_sym_db.RegisterEnumDescriptor(_INTENTVIEW) - -IntentView = enum_type_wrapper.EnumTypeWrapper(_INTENTVIEW) -INTENT_VIEW_UNSPECIFIED = 0 -INTENT_VIEW_FULL = 1 - - -_INTENT_TRAININGPHRASE_TYPE = _descriptor.EnumDescriptor( - name="Type", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EXAMPLE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TEMPLATE", - index=2, - number=2, - serialized_options=b"\010\001", - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1618, - serialized_end=1677, -) -_sym_db.RegisterEnumDescriptor(_INTENT_TRAININGPHRASE_TYPE) - -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIATYPE = _descriptor.EnumDescriptor( - name="ResponseMediaType", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="RESPONSE_MEDIA_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=5364, - serialized_end=5431, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIATYPE) - -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION_URLTYPEHINT = _descriptor.EnumDescriptor( - name="UrlTypeHint", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="URL_TYPE_HINT_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AMP_ACTION", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AMP_CONTENT", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=6132, - serialized_end=6209, -) -_sym_db.RegisterEnumDescriptor( - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION_URLTYPEHINT -) - -_INTENT_MESSAGE_BROWSECAROUSELCARD_IMAGEDISPLAYOPTIONS = _descriptor.EnumDescriptor( - name="ImageDisplayOptions", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="IMAGE_DISPLAY_OPTIONS_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="GRAY", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WHITE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CROPPED", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BLURRED_BACKGROUND", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=6211, - serialized_end=6329, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_BROWSECAROUSELCARD_IMAGEDISPLAYOPTIONS) - -_INTENT_MESSAGE_COLUMNPROPERTIES_HORIZONTALALIGNMENT = _descriptor.EnumDescriptor( - name="HorizontalAlignment", - full_name="google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="HORIZONTAL_ALIGNMENT_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LEADING", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CENTER", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TRAILING", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=6858, - serialized_end=6956, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_COLUMNPROPERTIES_HORIZONTALALIGNMENT) - -_INTENT_MESSAGE_PLATFORM = _descriptor.EnumDescriptor( - name="Platform", - full_name="google.cloud.dialogflow.v2.Intent.Message.Platform", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="PLATFORM_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FACEBOOK", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SLACK", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TELEGRAM", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="KIK", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SKYPE", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LINE", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VIBER", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ACTIONS_ON_GOOGLE", - index=8, - number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="GOOGLE_HANGOUTS", - index=9, - number=11, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=7112, - serialized_end=7272, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_PLATFORM) - -_INTENT_WEBHOOKSTATE = _descriptor.EnumDescriptor( - name="WebhookState", - full_name="google.cloud.dialogflow.v2.Intent.WebhookState", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="WEBHOOK_STATE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WEBHOOK_STATE_ENABLED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=7374, - serialized_end=7490, -) -_sym_db.RegisterEnumDescriptor(_INTENT_WEBHOOKSTATE) - - -_INTENT_TRAININGPHRASE_PART = _descriptor.Descriptor( - name="Part", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.entity_type", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="alias", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.alias", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="user_defined", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.user_defined", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1523, - serialized_end=1616, -) - -_INTENT_TRAININGPHRASE = _descriptor.Descriptor( - name="TrainingPhrase", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="type", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase.type", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parts", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase.parts", - index=2, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="times_added_count", - full_name="google.cloud.dialogflow.v2.Intent.TrainingPhrase.times_added_count", - index=3, - number=4, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_TRAININGPHRASE_PART], - enum_types=[_INTENT_TRAININGPHRASE_TYPE], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1308, - serialized_end=1677, -) - -_INTENT_PARAMETER = _descriptor.Descriptor( - name="Parameter", - full_name="google.cloud.dialogflow.v2.Intent.Parameter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.Intent.Parameter.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.dialogflow.v2.Intent.Parameter.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.cloud.dialogflow.v2.Intent.Parameter.value", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="default_value", - full_name="google.cloud.dialogflow.v2.Intent.Parameter.default_value", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type_display_name", - full_name="google.cloud.dialogflow.v2.Intent.Parameter.entity_type_display_name", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="mandatory", - full_name="google.cloud.dialogflow.v2.Intent.Parameter.mandatory", - index=5, - number=6, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="prompts", - full_name="google.cloud.dialogflow.v2.Intent.Parameter.prompts", - index=6, - number=7, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_list", - full_name="google.cloud.dialogflow.v2.Intent.Parameter.is_list", - index=7, - number=8, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1680, - serialized_end=1882, -) - -_INTENT_MESSAGE_TEXT = _descriptor.Descriptor( - name="Text", - full_name="google.cloud.dialogflow.v2.Intent.Message.Text", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2.Intent.Message.Text.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3048, - serialized_end=3073, -) - -_INTENT_MESSAGE_IMAGE = _descriptor.Descriptor( - name="Image", - full_name="google.cloud.dialogflow.v2.Intent.Message.Image", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="image_uri", - full_name="google.cloud.dialogflow.v2.Intent.Message.Image.image_uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="accessibility_text", - full_name="google.cloud.dialogflow.v2.Intent.Message.Image.accessibility_text", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3075, - serialized_end=3139, -) - -_INTENT_MESSAGE_QUICKREPLIES = _descriptor.Descriptor( - name="QuickReplies", - full_name="google.cloud.dialogflow.v2.Intent.Message.QuickReplies", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2.Intent.Message.QuickReplies.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="quick_replies", - full_name="google.cloud.dialogflow.v2.Intent.Message.QuickReplies.quick_replies", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3141, - serialized_end=3203, -) - -_INTENT_MESSAGE_CARD_BUTTON = _descriptor.Descriptor( - name="Button", - full_name="google.cloud.dialogflow.v2.Intent.Message.Card.Button", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2.Intent.Message.Card.Button.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="postback", - full_name="google.cloud.dialogflow.v2.Intent.Message.Card.Button.postback", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3359, - serialized_end=3409, -) - -_INTENT_MESSAGE_CARD = _descriptor.Descriptor( - name="Card", - full_name="google.cloud.dialogflow.v2.Intent.Message.Card", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2.Intent.Message.Card.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="subtitle", - full_name="google.cloud.dialogflow.v2.Intent.Message.Card.subtitle", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image_uri", - full_name="google.cloud.dialogflow.v2.Intent.Message.Card.image_uri", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="buttons", - full_name="google.cloud.dialogflow.v2.Intent.Message.Card.buttons", - index=3, - number=4, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_CARD_BUTTON], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3206, - serialized_end=3409, -) - -_INTENT_MESSAGE_SIMPLERESPONSE = _descriptor.Descriptor( - name="SimpleResponse", - full_name="google.cloud.dialogflow.v2.Intent.Message.SimpleResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text_to_speech", - full_name="google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.text_to_speech", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="ssml", - full_name="google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.ssml", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_text", - full_name="google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.display_text", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3411, - serialized_end=3492, -) - -_INTENT_MESSAGE_SIMPLERESPONSES = _descriptor.Descriptor( - name="SimpleResponses", - full_name="google.cloud.dialogflow.v2.Intent.Message.SimpleResponses", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="simple_responses", - full_name="google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.simple_responses", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3494, - serialized_end=3601, -) - -_INTENT_MESSAGE_BASICCARD_BUTTON_OPENURIACTION = _descriptor.Descriptor( - name="OpenUriAction", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="uri", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction.uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3968, - serialized_end=3996, -) - -_INTENT_MESSAGE_BASICCARD_BUTTON = _descriptor.Descriptor( - name="Button", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="open_uri_action", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.open_uri_action", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_BASICCARD_BUTTON_OPENURIACTION], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3838, - serialized_end=3996, -) - -_INTENT_MESSAGE_BASICCARD = _descriptor.Descriptor( - name="BasicCard", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="subtitle", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard.subtitle", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="formatted_text", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard.formatted_text", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard.image", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="buttons", - full_name="google.cloud.dialogflow.v2.Intent.Message.BasicCard.buttons", - index=4, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_BASICCARD_BUTTON], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3604, - serialized_end=3996, -) - -_INTENT_MESSAGE_SUGGESTION = _descriptor.Descriptor( - name="Suggestion", - full_name="google.cloud.dialogflow.v2.Intent.Message.Suggestion", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2.Intent.Message.Suggestion.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3998, - serialized_end=4030, -) - -_INTENT_MESSAGE_SUGGESTIONS = _descriptor.Descriptor( - name="Suggestions", - full_name="google.cloud.dialogflow.v2.Intent.Message.Suggestions", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="suggestions", - full_name="google.cloud.dialogflow.v2.Intent.Message.Suggestions.suggestions", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4032, - serialized_end=4126, -) - -_INTENT_MESSAGE_LINKOUTSUGGESTION = _descriptor.Descriptor( - name="LinkOutSuggestion", - full_name="google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="destination_name", - full_name="google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.destination_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="uri", - full_name="google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4128, - serialized_end=4196, -) - -_INTENT_MESSAGE_LISTSELECT_ITEM = _descriptor.Descriptor( - name="Item", - full_name="google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="info", - full_name="google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.info", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.title", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.description", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.image", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4337, - serialized_end=4537, -) - -_INTENT_MESSAGE_LISTSELECT = _descriptor.Descriptor( - name="ListSelect", - full_name="google.cloud.dialogflow.v2.Intent.Message.ListSelect", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2.Intent.Message.ListSelect.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="items", - full_name="google.cloud.dialogflow.v2.Intent.Message.ListSelect.items", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="subtitle", - full_name="google.cloud.dialogflow.v2.Intent.Message.ListSelect.subtitle", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_LISTSELECT_ITEM], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4199, - serialized_end=4537, -) - -_INTENT_MESSAGE_CAROUSELSELECT_ITEM = _descriptor.Descriptor( - name="Item", - full_name="google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="info", - full_name="google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.info", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.title", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.description", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.image", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4337, - serialized_end=4537, -) - -_INTENT_MESSAGE_CAROUSELSELECT = _descriptor.Descriptor( - name="CarouselSelect", - full_name="google.cloud.dialogflow.v2.Intent.Message.CarouselSelect", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="items", - full_name="google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.items", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_CAROUSELSELECT_ITEM], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4540, - serialized_end=4843, -) - -_INTENT_MESSAGE_SELECTITEMINFO = _descriptor.Descriptor( - name="SelectItemInfo", - full_name="google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="synonyms", - full_name="google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.synonyms", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4845, - serialized_end=4902, -) - -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT = _descriptor.Descriptor( - name="ResponseMediaObject", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.description", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="large_image", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.large_image", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="icon", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.icon", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="content_url", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.content_url", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.image", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=5122, - serialized_end=5362, -) - -_INTENT_MESSAGE_MEDIACONTENT = _descriptor.Descriptor( - name="MediaContent", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="media_type", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent.media_type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="media_objects", - full_name="google.cloud.dialogflow.v2.Intent.Message.MediaContent.media_objects", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT], - enum_types=[_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIATYPE], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4905, - serialized_end=5431, -) - -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION = _descriptor.Descriptor( - name="OpenUrlAction", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="url", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.url", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="url_type_hint", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.url_type_hint", - index=1, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[ - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION_URLTYPEHINT - ], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5961, - serialized_end=6209, -) - -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM = _descriptor.Descriptor( - name="BrowseCarouselCardItem", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="open_uri_action", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.open_uri_action", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.title", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.description", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.image", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="footer", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.footer", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION - ], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5677, - serialized_end=6209, -) - -_INTENT_MESSAGE_BROWSECAROUSELCARD = _descriptor.Descriptor( - name="BrowseCarouselCard", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="items", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.items", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image_display_options", - full_name="google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.image_display_options", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM], - enum_types=[_INTENT_MESSAGE_BROWSECAROUSELCARD_IMAGEDISPLAYOPTIONS], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5434, - serialized_end=6329, -) - -_INTENT_MESSAGE_TABLECARD = _descriptor.Descriptor( - name="TableCard", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCard", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCard.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="subtitle", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCard.subtitle", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCard.image", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="column_properties", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCard.column_properties", - index=3, - number=4, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="rows", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCard.rows", - index=4, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="buttons", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCard.buttons", - index=5, - number=6, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6332, - serialized_end=6703, -) - -_INTENT_MESSAGE_COLUMNPROPERTIES = _descriptor.Descriptor( - name="ColumnProperties", - full_name="google.cloud.dialogflow.v2.Intent.Message.ColumnProperties", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="header", - full_name="google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.header", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="horizontal_alignment", - full_name="google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.horizontal_alignment", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_INTENT_MESSAGE_COLUMNPROPERTIES_HORIZONTALALIGNMENT], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6706, - serialized_end=6956, -) - -_INTENT_MESSAGE_TABLECARDROW = _descriptor.Descriptor( - name="TableCardRow", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCardRow", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="cells", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCardRow.cells", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="divider_after", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCardRow.divider_after", - index=1, - number=2, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6958, - serialized_end=7078, -) - -_INTENT_MESSAGE_TABLECARDCELL = _descriptor.Descriptor( - name="TableCardCell", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCardCell", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2.Intent.Message.TableCardCell.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7080, - serialized_end=7109, -) - -_INTENT_MESSAGE = _descriptor.Descriptor( - name="Message", - full_name="google.cloud.dialogflow.v2.Intent.Message", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2.Intent.Message.text", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2.Intent.Message.image", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="quick_replies", - full_name="google.cloud.dialogflow.v2.Intent.Message.quick_replies", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="card", - full_name="google.cloud.dialogflow.v2.Intent.Message.card", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="payload", - full_name="google.cloud.dialogflow.v2.Intent.Message.payload", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="simple_responses", - full_name="google.cloud.dialogflow.v2.Intent.Message.simple_responses", - index=5, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="basic_card", - full_name="google.cloud.dialogflow.v2.Intent.Message.basic_card", - index=6, - number=8, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="suggestions", - full_name="google.cloud.dialogflow.v2.Intent.Message.suggestions", - index=7, - number=9, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="link_out_suggestion", - full_name="google.cloud.dialogflow.v2.Intent.Message.link_out_suggestion", - index=8, - number=10, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="list_select", - full_name="google.cloud.dialogflow.v2.Intent.Message.list_select", - index=9, - number=11, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="carousel_select", - full_name="google.cloud.dialogflow.v2.Intent.Message.carousel_select", - index=10, - number=12, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="browse_carousel_card", - full_name="google.cloud.dialogflow.v2.Intent.Message.browse_carousel_card", - index=11, - number=22, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="table_card", - full_name="google.cloud.dialogflow.v2.Intent.Message.table_card", - index=12, - number=23, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="media_content", - full_name="google.cloud.dialogflow.v2.Intent.Message.media_content", - index=13, - number=24, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="platform", - full_name="google.cloud.dialogflow.v2.Intent.Message.platform", - index=14, - number=6, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _INTENT_MESSAGE_TEXT, - _INTENT_MESSAGE_IMAGE, - _INTENT_MESSAGE_QUICKREPLIES, - _INTENT_MESSAGE_CARD, - _INTENT_MESSAGE_SIMPLERESPONSE, - _INTENT_MESSAGE_SIMPLERESPONSES, - _INTENT_MESSAGE_BASICCARD, - _INTENT_MESSAGE_SUGGESTION, - _INTENT_MESSAGE_SUGGESTIONS, - _INTENT_MESSAGE_LINKOUTSUGGESTION, - _INTENT_MESSAGE_LISTSELECT, - _INTENT_MESSAGE_CAROUSELSELECT, - _INTENT_MESSAGE_SELECTITEMINFO, - _INTENT_MESSAGE_MEDIACONTENT, - _INTENT_MESSAGE_BROWSECAROUSELCARD, - _INTENT_MESSAGE_TABLECARD, - _INTENT_MESSAGE_COLUMNPROPERTIES, - _INTENT_MESSAGE_TABLECARDROW, - _INTENT_MESSAGE_TABLECARDCELL, - ], - enum_types=[_INTENT_MESSAGE_PLATFORM], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="message", - full_name="google.cloud.dialogflow.v2.Intent.Message.message", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=1885, - serialized_end=7283, -) - -_INTENT_FOLLOWUPINTENTINFO = _descriptor.Descriptor( - name="FollowupIntentInfo", - full_name="google.cloud.dialogflow.v2.Intent.FollowupIntentInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="followup_intent_name", - full_name="google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.followup_intent_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parent_followup_intent_name", - full_name="google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.parent_followup_intent_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7285, - serialized_end=7372, -) - -_INTENT = _descriptor.Descriptor( - name="Intent", - full_name="google.cloud.dialogflow.v2.Intent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.Intent.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.dialogflow.v2.Intent.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_state", - full_name="google.cloud.dialogflow.v2.Intent.webhook_state", - index=2, - number=6, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="priority", - full_name="google.cloud.dialogflow.v2.Intent.priority", - index=3, - number=3, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_fallback", - full_name="google.cloud.dialogflow.v2.Intent.is_fallback", - index=4, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="ml_disabled", - full_name="google.cloud.dialogflow.v2.Intent.ml_disabled", - index=5, - number=19, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="input_context_names", - full_name="google.cloud.dialogflow.v2.Intent.input_context_names", - index=6, - number=7, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="events", - full_name="google.cloud.dialogflow.v2.Intent.events", - index=7, - number=8, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="training_phrases", - full_name="google.cloud.dialogflow.v2.Intent.training_phrases", - index=8, - number=9, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="action", - full_name="google.cloud.dialogflow.v2.Intent.action", - index=9, - number=10, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_contexts", - full_name="google.cloud.dialogflow.v2.Intent.output_contexts", - index=10, - number=11, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="reset_contexts", - full_name="google.cloud.dialogflow.v2.Intent.reset_contexts", - index=11, - number=12, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parameters", - full_name="google.cloud.dialogflow.v2.Intent.parameters", - index=12, - number=13, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="messages", - full_name="google.cloud.dialogflow.v2.Intent.messages", - index=13, - number=14, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="default_response_platforms", - full_name="google.cloud.dialogflow.v2.Intent.default_response_platforms", - index=14, - number=15, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="root_followup_intent_name", - full_name="google.cloud.dialogflow.v2.Intent.root_followup_intent_name", - index=15, - number=16, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parent_followup_intent_name", - full_name="google.cloud.dialogflow.v2.Intent.parent_followup_intent_name", - index=16, - number=17, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="followup_intent_info", - full_name="google.cloud.dialogflow.v2.Intent.followup_intent_info", - index=17, - number=18, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _INTENT_TRAININGPHRASE, - _INTENT_PARAMETER, - _INTENT_MESSAGE, - _INTENT_FOLLOWUPINTENTINFO, - ], - enum_types=[_INTENT_WEBHOOKSTATE], - serialized_options=b"\352AM\n dialogflow.googleapis.com/Intent\022)projects/{project}/agent/intents/{intent}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=456, - serialized_end=7572, -) - - -_LISTINTENTSREQUEST = _descriptor.Descriptor( - name="ListIntentsRequest", - full_name="google.cloud.dialogflow.v2.ListIntentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.ListIntentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\022 dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.ListIntentsRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_view", - full_name="google.cloud.dialogflow.v2.ListIntentsRequest.intent_view", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2.ListIntentsRequest.page_size", - index=3, - number=4, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2.ListIntentsRequest.page_token", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7575, - serialized_end=7796, -) - - -_LISTINTENTSRESPONSE = _descriptor.Descriptor( - name="ListIntentsResponse", - full_name="google.cloud.dialogflow.v2.ListIntentsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="intents", - full_name="google.cloud.dialogflow.v2.ListIntentsResponse.intents", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2.ListIntentsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7798, - serialized_end=7897, -) - - -_GETINTENTREQUEST = _descriptor.Descriptor( - name="GetIntentRequest", - full_name="google.cloud.dialogflow.v2.GetIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.GetIntentRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\n dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.GetIntentRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_view", - full_name="google.cloud.dialogflow.v2.GetIntentRequest.intent_view", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7900, - serialized_end=8068, -) - - -_CREATEINTENTREQUEST = _descriptor.Descriptor( - name="CreateIntentRequest", - full_name="google.cloud.dialogflow.v2.CreateIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.CreateIntentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\022 dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent", - full_name="google.cloud.dialogflow.v2.CreateIntentRequest.intent", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.CreateIntentRequest.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_view", - full_name="google.cloud.dialogflow.v2.CreateIntentRequest.intent_view", - index=3, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8071, - serialized_end=8301, -) - - -_UPDATEINTENTREQUEST = _descriptor.Descriptor( - name="UpdateIntentRequest", - full_name="google.cloud.dialogflow.v2.UpdateIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="intent", - full_name="google.cloud.dialogflow.v2.UpdateIntentRequest.intent", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.UpdateIntentRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2.UpdateIntentRequest.update_mask", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_view", - full_name="google.cloud.dialogflow.v2.UpdateIntentRequest.intent_view", - index=3, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8304, - serialized_end=8530, -) - - -_DELETEINTENTREQUEST = _descriptor.Descriptor( - name="DeleteIntentRequest", - full_name="google.cloud.dialogflow.v2.DeleteIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.DeleteIntentRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\n dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8532, - serialized_end=8609, -) - - -_BATCHUPDATEINTENTSREQUEST = _descriptor.Descriptor( - name="BatchUpdateIntentsRequest", - full_name="google.cloud.dialogflow.v2.BatchUpdateIntentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\022 dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_batch_uri", - full_name="google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.intent_batch_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_batch_inline", - full_name="google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.intent_batch_inline", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.language_code", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.update_mask", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_view", - full_name="google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.intent_view", - index=5, - number=6, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="intent_batch", - full_name="google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.intent_batch", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=8612, - serialized_end=8961, -) - - -_BATCHUPDATEINTENTSRESPONSE = _descriptor.Descriptor( - name="BatchUpdateIntentsResponse", - full_name="google.cloud.dialogflow.v2.BatchUpdateIntentsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="intents", - full_name="google.cloud.dialogflow.v2.BatchUpdateIntentsResponse.intents", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8963, - serialized_end=9044, -) - - -_BATCHDELETEINTENTSREQUEST = _descriptor.Descriptor( - name="BatchDeleteIntentsRequest", - full_name="google.cloud.dialogflow.v2.BatchDeleteIntentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.BatchDeleteIntentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\022 dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intents", - full_name="google.cloud.dialogflow.v2.BatchDeleteIntentsRequest.intents", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=9047, - serialized_end=9190, -) - - -_INTENTBATCH = _descriptor.Descriptor( - name="IntentBatch", - full_name="google.cloud.dialogflow.v2.IntentBatch", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="intents", - full_name="google.cloud.dialogflow.v2.IntentBatch.intents", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=9192, - serialized_end=9258, -) - -_INTENT_TRAININGPHRASE_PART.containing_type = _INTENT_TRAININGPHRASE -_INTENT_TRAININGPHRASE.fields_by_name["type"].enum_type = _INTENT_TRAININGPHRASE_TYPE -_INTENT_TRAININGPHRASE.fields_by_name[ - "parts" -].message_type = _INTENT_TRAININGPHRASE_PART -_INTENT_TRAININGPHRASE.containing_type = _INTENT -_INTENT_TRAININGPHRASE_TYPE.containing_type = _INTENT_TRAININGPHRASE -_INTENT_PARAMETER.containing_type = _INTENT -_INTENT_MESSAGE_TEXT.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_IMAGE.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_QUICKREPLIES.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_CARD_BUTTON.containing_type = _INTENT_MESSAGE_CARD -_INTENT_MESSAGE_CARD.fields_by_name[ - "buttons" -].message_type = _INTENT_MESSAGE_CARD_BUTTON -_INTENT_MESSAGE_CARD.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_SIMPLERESPONSE.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_SIMPLERESPONSES.fields_by_name[ - "simple_responses" -].message_type = _INTENT_MESSAGE_SIMPLERESPONSE -_INTENT_MESSAGE_SIMPLERESPONSES.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_BASICCARD_BUTTON_OPENURIACTION.containing_type = ( - _INTENT_MESSAGE_BASICCARD_BUTTON -) -_INTENT_MESSAGE_BASICCARD_BUTTON.fields_by_name[ - "open_uri_action" -].message_type = _INTENT_MESSAGE_BASICCARD_BUTTON_OPENURIACTION -_INTENT_MESSAGE_BASICCARD_BUTTON.containing_type = _INTENT_MESSAGE_BASICCARD -_INTENT_MESSAGE_BASICCARD.fields_by_name["image"].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_BASICCARD.fields_by_name[ - "buttons" -].message_type = _INTENT_MESSAGE_BASICCARD_BUTTON -_INTENT_MESSAGE_BASICCARD.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_SUGGESTION.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_SUGGESTIONS.fields_by_name[ - "suggestions" -].message_type = _INTENT_MESSAGE_SUGGESTION -_INTENT_MESSAGE_SUGGESTIONS.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_LINKOUTSUGGESTION.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_LISTSELECT_ITEM.fields_by_name[ - "info" -].message_type = _INTENT_MESSAGE_SELECTITEMINFO -_INTENT_MESSAGE_LISTSELECT_ITEM.fields_by_name[ - "image" -].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_LISTSELECT_ITEM.containing_type = _INTENT_MESSAGE_LISTSELECT -_INTENT_MESSAGE_LISTSELECT.fields_by_name[ - "items" -].message_type = _INTENT_MESSAGE_LISTSELECT_ITEM -_INTENT_MESSAGE_LISTSELECT.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_CAROUSELSELECT_ITEM.fields_by_name[ - "info" -].message_type = _INTENT_MESSAGE_SELECTITEMINFO -_INTENT_MESSAGE_CAROUSELSELECT_ITEM.fields_by_name[ - "image" -].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_CAROUSELSELECT_ITEM.containing_type = _INTENT_MESSAGE_CAROUSELSELECT -_INTENT_MESSAGE_CAROUSELSELECT.fields_by_name[ - "items" -].message_type = _INTENT_MESSAGE_CAROUSELSELECT_ITEM -_INTENT_MESSAGE_CAROUSELSELECT.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_SELECTITEMINFO.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name[ - "large_image" -].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name[ - "icon" -].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.containing_type = ( - _INTENT_MESSAGE_MEDIACONTENT -) -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.oneofs_by_name["image"].fields.append( - _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name["large_image"] -) -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name[ - "large_image" -].containing_oneof = _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.oneofs_by_name[ - "image" -] -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.oneofs_by_name["image"].fields.append( - _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name["icon"] -) -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name[ - "icon" -].containing_oneof = _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.oneofs_by_name[ - "image" -] -_INTENT_MESSAGE_MEDIACONTENT.fields_by_name[ - "media_type" -].enum_type = _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIATYPE -_INTENT_MESSAGE_MEDIACONTENT.fields_by_name[ - "media_objects" -].message_type = _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT -_INTENT_MESSAGE_MEDIACONTENT.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIATYPE.containing_type = ( - _INTENT_MESSAGE_MEDIACONTENT -) -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION.fields_by_name[ - "url_type_hint" -].enum_type = ( - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION_URLTYPEHINT -) -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION.containing_type = ( - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM -) -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION_URLTYPEHINT.containing_type = ( - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION -) -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM.fields_by_name[ - "open_uri_action" -].message_type = _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM.fields_by_name[ - "image" -].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM.containing_type = ( - _INTENT_MESSAGE_BROWSECAROUSELCARD -) -_INTENT_MESSAGE_BROWSECAROUSELCARD.fields_by_name[ - "items" -].message_type = _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM -_INTENT_MESSAGE_BROWSECAROUSELCARD.fields_by_name[ - "image_display_options" -].enum_type = _INTENT_MESSAGE_BROWSECAROUSELCARD_IMAGEDISPLAYOPTIONS -_INTENT_MESSAGE_BROWSECAROUSELCARD.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_BROWSECAROUSELCARD_IMAGEDISPLAYOPTIONS.containing_type = ( - _INTENT_MESSAGE_BROWSECAROUSELCARD -) -_INTENT_MESSAGE_TABLECARD.fields_by_name["image"].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_TABLECARD.fields_by_name[ - "column_properties" -].message_type = _INTENT_MESSAGE_COLUMNPROPERTIES -_INTENT_MESSAGE_TABLECARD.fields_by_name[ - "rows" -].message_type = _INTENT_MESSAGE_TABLECARDROW -_INTENT_MESSAGE_TABLECARD.fields_by_name[ - "buttons" -].message_type = _INTENT_MESSAGE_BASICCARD_BUTTON -_INTENT_MESSAGE_TABLECARD.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_COLUMNPROPERTIES.fields_by_name[ - "horizontal_alignment" -].enum_type = _INTENT_MESSAGE_COLUMNPROPERTIES_HORIZONTALALIGNMENT -_INTENT_MESSAGE_COLUMNPROPERTIES.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_COLUMNPROPERTIES_HORIZONTALALIGNMENT.containing_type = ( - _INTENT_MESSAGE_COLUMNPROPERTIES -) -_INTENT_MESSAGE_TABLECARDROW.fields_by_name[ - "cells" -].message_type = _INTENT_MESSAGE_TABLECARDCELL -_INTENT_MESSAGE_TABLECARDROW.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_TABLECARDCELL.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE.fields_by_name["text"].message_type = _INTENT_MESSAGE_TEXT -_INTENT_MESSAGE.fields_by_name["image"].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE.fields_by_name[ - "quick_replies" -].message_type = _INTENT_MESSAGE_QUICKREPLIES -_INTENT_MESSAGE.fields_by_name["card"].message_type = _INTENT_MESSAGE_CARD -_INTENT_MESSAGE.fields_by_name[ - "payload" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_INTENT_MESSAGE.fields_by_name[ - "simple_responses" -].message_type = _INTENT_MESSAGE_SIMPLERESPONSES -_INTENT_MESSAGE.fields_by_name["basic_card"].message_type = _INTENT_MESSAGE_BASICCARD -_INTENT_MESSAGE.fields_by_name["suggestions"].message_type = _INTENT_MESSAGE_SUGGESTIONS -_INTENT_MESSAGE.fields_by_name[ - "link_out_suggestion" -].message_type = _INTENT_MESSAGE_LINKOUTSUGGESTION -_INTENT_MESSAGE.fields_by_name["list_select"].message_type = _INTENT_MESSAGE_LISTSELECT -_INTENT_MESSAGE.fields_by_name[ - "carousel_select" -].message_type = _INTENT_MESSAGE_CAROUSELSELECT -_INTENT_MESSAGE.fields_by_name[ - "browse_carousel_card" -].message_type = _INTENT_MESSAGE_BROWSECAROUSELCARD -_INTENT_MESSAGE.fields_by_name["table_card"].message_type = _INTENT_MESSAGE_TABLECARD -_INTENT_MESSAGE.fields_by_name[ - "media_content" -].message_type = _INTENT_MESSAGE_MEDIACONTENT -_INTENT_MESSAGE.fields_by_name["platform"].enum_type = _INTENT_MESSAGE_PLATFORM -_INTENT_MESSAGE.containing_type = _INTENT -_INTENT_MESSAGE_PLATFORM.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["text"] -) -_INTENT_MESSAGE.fields_by_name[ - "text" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["image"] -) -_INTENT_MESSAGE.fields_by_name[ - "image" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["quick_replies"] -) -_INTENT_MESSAGE.fields_by_name[ - "quick_replies" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["card"] -) -_INTENT_MESSAGE.fields_by_name[ - "card" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["payload"] -) -_INTENT_MESSAGE.fields_by_name[ - "payload" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["simple_responses"] -) -_INTENT_MESSAGE.fields_by_name[ - "simple_responses" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["basic_card"] -) -_INTENT_MESSAGE.fields_by_name[ - "basic_card" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["suggestions"] -) -_INTENT_MESSAGE.fields_by_name[ - "suggestions" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["link_out_suggestion"] -) -_INTENT_MESSAGE.fields_by_name[ - "link_out_suggestion" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["list_select"] -) -_INTENT_MESSAGE.fields_by_name[ - "list_select" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["carousel_select"] -) -_INTENT_MESSAGE.fields_by_name[ - "carousel_select" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["browse_carousel_card"] -) -_INTENT_MESSAGE.fields_by_name[ - "browse_carousel_card" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["table_card"] -) -_INTENT_MESSAGE.fields_by_name[ - "table_card" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["media_content"] -) -_INTENT_MESSAGE.fields_by_name[ - "media_content" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_FOLLOWUPINTENTINFO.containing_type = _INTENT -_INTENT.fields_by_name["webhook_state"].enum_type = _INTENT_WEBHOOKSTATE -_INTENT.fields_by_name["training_phrases"].message_type = _INTENT_TRAININGPHRASE -_INTENT.fields_by_name[ - "output_contexts" -].message_type = google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2._CONTEXT -_INTENT.fields_by_name["parameters"].message_type = _INTENT_PARAMETER -_INTENT.fields_by_name["messages"].message_type = _INTENT_MESSAGE -_INTENT.fields_by_name[ - "default_response_platforms" -].enum_type = _INTENT_MESSAGE_PLATFORM -_INTENT.fields_by_name["followup_intent_info"].message_type = _INTENT_FOLLOWUPINTENTINFO -_INTENT_WEBHOOKSTATE.containing_type = _INTENT -_LISTINTENTSREQUEST.fields_by_name["intent_view"].enum_type = _INTENTVIEW -_LISTINTENTSRESPONSE.fields_by_name["intents"].message_type = _INTENT -_GETINTENTREQUEST.fields_by_name["intent_view"].enum_type = _INTENTVIEW -_CREATEINTENTREQUEST.fields_by_name["intent"].message_type = _INTENT -_CREATEINTENTREQUEST.fields_by_name["intent_view"].enum_type = _INTENTVIEW -_UPDATEINTENTREQUEST.fields_by_name["intent"].message_type = _INTENT -_UPDATEINTENTREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_UPDATEINTENTREQUEST.fields_by_name["intent_view"].enum_type = _INTENTVIEW -_BATCHUPDATEINTENTSREQUEST.fields_by_name[ - "intent_batch_inline" -].message_type = _INTENTBATCH -_BATCHUPDATEINTENTSREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_BATCHUPDATEINTENTSREQUEST.fields_by_name["intent_view"].enum_type = _INTENTVIEW -_BATCHUPDATEINTENTSREQUEST.oneofs_by_name["intent_batch"].fields.append( - _BATCHUPDATEINTENTSREQUEST.fields_by_name["intent_batch_uri"] -) -_BATCHUPDATEINTENTSREQUEST.fields_by_name[ - "intent_batch_uri" -].containing_oneof = _BATCHUPDATEINTENTSREQUEST.oneofs_by_name["intent_batch"] -_BATCHUPDATEINTENTSREQUEST.oneofs_by_name["intent_batch"].fields.append( - _BATCHUPDATEINTENTSREQUEST.fields_by_name["intent_batch_inline"] -) -_BATCHUPDATEINTENTSREQUEST.fields_by_name[ - "intent_batch_inline" -].containing_oneof = _BATCHUPDATEINTENTSREQUEST.oneofs_by_name["intent_batch"] -_BATCHUPDATEINTENTSRESPONSE.fields_by_name["intents"].message_type = _INTENT -_BATCHDELETEINTENTSREQUEST.fields_by_name["intents"].message_type = _INTENT -_INTENTBATCH.fields_by_name["intents"].message_type = _INTENT -DESCRIPTOR.message_types_by_name["Intent"] = _INTENT -DESCRIPTOR.message_types_by_name["ListIntentsRequest"] = _LISTINTENTSREQUEST -DESCRIPTOR.message_types_by_name["ListIntentsResponse"] = _LISTINTENTSRESPONSE -DESCRIPTOR.message_types_by_name["GetIntentRequest"] = _GETINTENTREQUEST -DESCRIPTOR.message_types_by_name["CreateIntentRequest"] = _CREATEINTENTREQUEST -DESCRIPTOR.message_types_by_name["UpdateIntentRequest"] = _UPDATEINTENTREQUEST -DESCRIPTOR.message_types_by_name["DeleteIntentRequest"] = _DELETEINTENTREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchUpdateIntentsRequest" -] = _BATCHUPDATEINTENTSREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchUpdateIntentsResponse" -] = _BATCHUPDATEINTENTSRESPONSE -DESCRIPTOR.message_types_by_name[ - "BatchDeleteIntentsRequest" -] = _BATCHDELETEINTENTSREQUEST -DESCRIPTOR.message_types_by_name["IntentBatch"] = _INTENTBATCH -DESCRIPTOR.enum_types_by_name["IntentView"] = _INTENTVIEW -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Intent = _reflection.GeneratedProtocolMessageType( - "Intent", - (_message.Message,), - { - "TrainingPhrase": _reflection.GeneratedProtocolMessageType( - "TrainingPhrase", - (_message.Message,), - { - "Part": _reflection.GeneratedProtocolMessageType( - "Part", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_TRAININGPHRASE_PART, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Represents a part of a training phrase. - - Attributes: - text: - Required. The text for this part. - entity_type: - Optional. The entity type name prefixed with ``@``. This field - is required for annotated parts of the training phrase. - alias: - Optional. The parameter name for the value extracted from the - annotated part of the example. This field is required for - annotated parts of the training phrase. - user_defined: - Optional. Indicates whether the text was manually annotated. - This field is set to true when the Dialogflow Console is used - to manually annotate the part. When creating an annotated part - with the API, you must set this to true. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part) - }, - ), - "DESCRIPTOR": _INTENT_TRAININGPHRASE, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Represents an example that the agent is trained on. - - Attributes: - name: - Output only. The unique identifier of this training phrase. - type: - Required. The type of the training phrase. - parts: - Required. The ordered list of training phrase parts. The parts - are concatenated in order to form the training phrase. Note: - The API does not automatically annotate training phrases like - the Dialogflow Console does. Note: Do not forget to include - whitespace at part boundaries, so the training phrase is well - formatted when the parts are concatenated. If the training - phrase does not need to be annotated with parameters, you just - need a single part with only the [Part.text][google.cloud.dial - ogflow.v2.Intent.TrainingPhrase.Part.text] field set. If you - want to annotate the training phrase, you must create multiple - parts, where the fields of each part are populated in one of - two ways: - ``Part.text`` is set to a part of the phrase - that has no parameters. - ``Part.text`` is set to a part of - the phrase that you want to annotate, and the - ``entity_type``, ``alias``, and ``user_defined`` fields are - all set. - times_added_count: - Optional. Indicates how many times this example was added to - the intent. Each time a developer adds an existing sample by - editing an intent or training, this counter is increased. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.TrainingPhrase) - }, - ), - "Parameter": _reflection.GeneratedProtocolMessageType( - "Parameter", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_PARAMETER, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Represents intent parameters. - - Attributes: - name: - The unique identifier of this parameter. - display_name: - Required. The name of the parameter. - value: - Optional. The definition of the parameter value. It can be: - - a constant string, - a parameter value defined as - ``$parameter_name``, - an original parameter value defined as - ``$parameter_name.original``, - a parameter value from some - context defined as ``#context_name.parameter_name``. - default_value: - Optional. The default value to use when the ``value`` yields - an empty result. Default values can be extracted from contexts - by using the following syntax: - ``#context_name.parameter_name``. - entity_type_display_name: - Optional. The name of the entity type, prefixed with ``@``, - that describes values of the parameter. If the parameter is - required, this must be provided. - mandatory: - Optional. Indicates whether the parameter is required. That - is, whether the intent cannot be completed without collecting - the parameter value. - prompts: - Optional. The collection of prompts that the agent can present - to the user in order to collect a value for the parameter. - is_list: - Optional. Indicates whether the parameter represents a list of - values. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Parameter) - }, - ), - "Message": _reflection.GeneratedProtocolMessageType( - "Message", - (_message.Message,), - { - "Text": _reflection.GeneratedProtocolMessageType( - "Text", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TEXT, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The text response message. - - Attributes: - text: - Optional. The collection of the agent’s responses. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.Text) - }, - ), - "Image": _reflection.GeneratedProtocolMessageType( - "Image", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_IMAGE, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The image response message. - - Attributes: - image_uri: - Optional. The public URI to an image file. - accessibility_text: - Optional. A text description of the image to be used for - accessibility, e.g., screen readers. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.Image) - }, - ), - "QuickReplies": _reflection.GeneratedProtocolMessageType( - "QuickReplies", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_QUICKREPLIES, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The quick replies response message. - - Attributes: - title: - Optional. The title of the collection of quick replies. - quick_replies: - Optional. The collection of quick replies. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.QuickReplies) - }, - ), - "Card": _reflection.GeneratedProtocolMessageType( - "Card", - (_message.Message,), - { - "Button": _reflection.GeneratedProtocolMessageType( - "Button", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_CARD_BUTTON, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Contains information about a button. - - Attributes: - text: - Optional. The text to show on the button. - postback: - Optional. The text to send back to the Dialogflow API or a URI - to open. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.Card.Button) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_CARD, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The card response message. - - Attributes: - title: - Optional. The title of the card. - subtitle: - Optional. The subtitle of the card. - image_uri: - Optional. The public URI to an image file for the card. - buttons: - Optional. The collection of card buttons. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.Card) - }, - ), - "SimpleResponse": _reflection.GeneratedProtocolMessageType( - "SimpleResponse", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_SIMPLERESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The simple response message containing speech or text. - - Attributes: - text_to_speech: - One of text_to_speech or ssml must be provided. The plain text - of the speech output. Mutually exclusive with ssml. - ssml: - One of text_to_speech or ssml must be provided. Structured - spoken response to the user in the SSML format. Mutually - exclusive with text_to_speech. - display_text: - Optional. The text to display. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.SimpleResponse) - }, - ), - "SimpleResponses": _reflection.GeneratedProtocolMessageType( - "SimpleResponses", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_SIMPLERESPONSES, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The collection of simple response candidates. This message in - ``QueryResult.fulfillment_messages`` and - ``WebhookResponse.fulfillment_messages`` should contain only one - ``SimpleResponse``. - - Attributes: - simple_responses: - Required. The list of simple responses. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.SimpleResponses) - }, - ), - "BasicCard": _reflection.GeneratedProtocolMessageType( - "BasicCard", - (_message.Message,), - { - "Button": _reflection.GeneratedProtocolMessageType( - "Button", - (_message.Message,), - { - "OpenUriAction": _reflection.GeneratedProtocolMessageType( - "OpenUriAction", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_BASICCARD_BUTTON_OPENURIACTION, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Opens the given URI. - - Attributes: - uri: - Required. The HTTP or HTTPS scheme URI. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_BASICCARD_BUTTON, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The button object that appears at the bottom of a card. - - Attributes: - title: - Required. The title of the button. - open_uri_action: - Required. Action to take when a user taps on the button. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_BASICCARD, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The basic card message. Useful for displaying information. - - Attributes: - title: - Optional. The title of the card. - subtitle: - Optional. The subtitle of the card. - formatted_text: - Required, unless image is present. The body text of the card. - image: - Optional. The image for the card. - buttons: - Optional. The collection of card buttons. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.BasicCard) - }, - ), - "Suggestion": _reflection.GeneratedProtocolMessageType( - "Suggestion", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_SUGGESTION, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The suggestion chip message that the user can tap to quickly post a - reply to the conversation. - - Attributes: - title: - Required. The text shown the in the suggestion chip. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.Suggestion) - }, - ), - "Suggestions": _reflection.GeneratedProtocolMessageType( - "Suggestions", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_SUGGESTIONS, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The collection of suggestions. - - Attributes: - suggestions: - Required. The list of suggested replies. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.Suggestions) - }, - ), - "LinkOutSuggestion": _reflection.GeneratedProtocolMessageType( - "LinkOutSuggestion", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_LINKOUTSUGGESTION, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The suggestion chip message that allows the user to jump out to the - app or website associated with this agent. - - Attributes: - destination_name: - Required. The name of the app or site this chip is linking to. - uri: - Required. The URI of the app or site to open when the user - taps the suggestion chip. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion) - }, - ), - "ListSelect": _reflection.GeneratedProtocolMessageType( - "ListSelect", - (_message.Message,), - { - "Item": _reflection.GeneratedProtocolMessageType( - "Item", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_LISTSELECT_ITEM, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """An item in the list. - - Attributes: - info: - Required. Additional information about this option. - title: - Required. The title of the list item. - description: - Optional. The main text describing the item. - image: - Optional. The image to display. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_LISTSELECT, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The card for presenting a list of options to select from. - - Attributes: - title: - Optional. The overall title of the list. - items: - Required. List items. - subtitle: - Optional. Subtitle of the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.ListSelect) - }, - ), - "CarouselSelect": _reflection.GeneratedProtocolMessageType( - "CarouselSelect", - (_message.Message,), - { - "Item": _reflection.GeneratedProtocolMessageType( - "Item", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_CAROUSELSELECT_ITEM, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """An item in the carousel. - - Attributes: - info: - Required. Additional info about the option item. - title: - Required. Title of the carousel item. - description: - Optional. The body text of the card. - image: - Optional. The image to display. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_CAROUSELSELECT, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The card for presenting a carousel of options to select from. - - Attributes: - items: - Required. Carousel items. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.CarouselSelect) - }, - ), - "SelectItemInfo": _reflection.GeneratedProtocolMessageType( - "SelectItemInfo", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_SELECTITEMINFO, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Additional info about the select item for when it is triggered in a - dialog. - - Attributes: - key: - Required. A unique key that will be sent back to the agent if - this response is given. - synonyms: - Optional. A list of synonyms that can also be used to trigger - this item in dialog. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo) - }, - ), - "MediaContent": _reflection.GeneratedProtocolMessageType( - "MediaContent", - (_message.Message,), - { - "ResponseMediaObject": _reflection.GeneratedProtocolMessageType( - "ResponseMediaObject", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Response media object for media content card. - - Attributes: - name: - Required. Name of media card. - description: - Optional. Description of media card. - image: - Image to show with the media card. - large_image: - Optional. Image to display above media content. - icon: - Optional. Icon to display above media content. - content_url: - Required. Url where the media is stored. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_MEDIACONTENT, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The media content card for Actions on Google. - - Attributes: - media_type: - Optional. What type of media is the content (ie “audio”). - media_objects: - Required. List of media objects. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.MediaContent) - }, - ), - "BrowseCarouselCard": _reflection.GeneratedProtocolMessageType( - "BrowseCarouselCard", - (_message.Message,), - { - "BrowseCarouselCardItem": _reflection.GeneratedProtocolMessageType( - "BrowseCarouselCardItem", - (_message.Message,), - { - "OpenUrlAction": _reflection.GeneratedProtocolMessageType( - "OpenUrlAction", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Actions on Google action to open a given url. - - Attributes: - url: - Required. URL - url_type_hint: - Optional. Specifies the type of viewer that is used when - opening the URL. Defaults to opening via web browser. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Browsing carousel tile - - Attributes: - open_uri_action: - Required. Action to present to the user. - title: - Required. Title of the carousel item. Maximum of two lines of - text. - description: - Optional. Description of the carousel item. Maximum of four - lines of text. - image: - Optional. Hero image for the carousel item. - footer: - Optional. Text that appears at the bottom of the Browse - Carousel Card. Maximum of one line of text. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_BROWSECAROUSELCARD, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Browse Carousel Card for Actions on Google. https://developers.google. - com/actions/assistant/responses#browsing_carousel - - Attributes: - items: - Required. List of items in the Browse Carousel Card. Minimum - of two items, maximum of ten. - image_display_options: - Optional. Settings for displaying the image. Applies to every - image in [items][google.cloud.dialogflow.v2.Intent.Message.Bro - wseCarouselCard.items]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard) - }, - ), - "TableCard": _reflection.GeneratedProtocolMessageType( - "TableCard", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TABLECARD, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Table card for Actions on Google. - - Attributes: - title: - Required. Title of the card. - subtitle: - Optional. Subtitle to the title. - image: - Optional. Image which should be displayed on the card. - column_properties: - Optional. Display properties for the columns in this table. - rows: - Optional. Rows in this table of data. - buttons: - Optional. List of buttons for the card. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.TableCard) - }, - ), - "ColumnProperties": _reflection.GeneratedProtocolMessageType( - "ColumnProperties", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_COLUMNPROPERTIES, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Column properties for - [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard]. - - Attributes: - header: - Required. Column heading. - horizontal_alignment: - Optional. Defines text alignment for all cells in this column. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.ColumnProperties) - }, - ), - "TableCardRow": _reflection.GeneratedProtocolMessageType( - "TableCardRow", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TABLECARDROW, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Row of - [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard]. - - Attributes: - cells: - Optional. List of cells that make up this row. - divider_after: - Optional. Whether to add a visual divider after this row. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.TableCardRow) - }, - ), - "TableCardCell": _reflection.GeneratedProtocolMessageType( - "TableCardCell", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TABLECARDCELL, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Cell of [TableCardRow][google.cloud.dialogflow.v2.Intent.Message.Table - CardRow]. - - Attributes: - text: - Required. Text in this cell. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message.TableCardCell) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """A rich response message. Corresponds to the intent ``Response`` field - in the Dialogflow console. For more information, see `Rich response - messages `__. - - Attributes: - message: - Required. The rich response message. - text: - The text response. - image: - The image response. - quick_replies: - The quick replies response. - card: - The card response. - payload: - A custom platform-specific response. - simple_responses: - The voice and text-only responses for Actions on Google. - basic_card: - The basic card response for Actions on Google. - suggestions: - The suggestion chips for Actions on Google. - link_out_suggestion: - The link out suggestion chip for Actions on Google. - list_select: - The list card response for Actions on Google. - carousel_select: - The carousel card response for Actions on Google. - browse_carousel_card: - Browse carousel card for Actions on Google. - table_card: - Table card for Actions on Google. - media_content: - The media content card for Actions on Google. - platform: - Optional. The platform that this message is intended for. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.Message) - }, - ), - "FollowupIntentInfo": _reflection.GeneratedProtocolMessageType( - "FollowupIntentInfo", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_FOLLOWUPINTENTINFO, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Represents a single followup intent in the chain. - - Attributes: - followup_intent_name: - The unique identifier of the followup intent. Format: - ``projects//agent/intents/``. - parent_followup_intent_name: - The unique identifier of the followup intent’s parent. Format: - ``projects//agent/intents/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent.FollowupIntentInfo) - }, - ), - "DESCRIPTOR": _INTENT, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """An intent categorizes an end-user’s intention for one conversation - turn. For each agent, you define many intents, where your combined - intents can handle a complete conversation. When an end-user writes or - says something, referred to as an end-user expression or end-user - input, Dialogflow matches the end-user input to the best intent in - your agent. Matching an intent is also known as intent classification. - For more information, see the `intent guide - `__. - - Attributes: - name: - Optional. The unique identifier of this intent. Required for [ - Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.Updat - eIntent] and [Intents.BatchUpdateIntents][google.cloud.dialogf - low.v2.Intents.BatchUpdateIntents] methods. Format: - ``projects//agent/intents/``. - display_name: - Required. The name of this intent. - webhook_state: - Optional. Indicates whether webhooks are enabled for the - intent. - priority: - Optional. The priority of this intent. Higher numbers - represent higher priorities. - If the supplied value is - unspecified or 0, the service translates the value to - 500,000, which corresponds to the ``Normal`` priority in the - console. - If the supplied value is negative, the intent is - ignored in runtime detect intent requests. - is_fallback: - Optional. Indicates whether this is a fallback intent. - ml_disabled: - Optional. Indicates whether Machine Learning is disabled for - the intent. Note: If ``ml_disabled`` setting is set to true, - then this intent is not taken into account during inference in - ``ML ONLY`` match mode. Also, auto-markup in the UI is turned - off. - input_context_names: - Optional. The list of context names required for this intent - to be triggered. Format: ``projects//agent/sessions/-/contexts/``. - events: - Optional. The collection of event names that trigger the - intent. If the collection of input contexts is not empty, all - of the contexts must be present in the active user session for - an event to trigger this intent. Event names are limited to - 150 characters. - training_phrases: - Optional. The collection of examples that the agent is trained - on. - action: - Optional. The name of the action associated with the intent. - Note: The action name must not contain whitespaces. - output_contexts: - Optional. The collection of contexts that are activated when - the intent is matched. Context messages in this collection - should not set the parameters field. Setting the - ``lifespan_count`` to 0 will reset the context when the intent - is matched. Format: ``projects//agent/sessions/-/contexts/``. - reset_contexts: - Optional. Indicates whether to delete all contexts in the - current session when this intent is matched. - parameters: - Optional. The collection of parameters associated with the - intent. - messages: - Optional. The collection of rich messages corresponding to the - ``Response`` field in the Dialogflow console. - default_response_platforms: - Optional. The list of platforms for which the first responses - will be copied from the messages in PLATFORM_UNSPECIFIED - (i.e. default platform). - root_followup_intent_name: - Read-only. The unique identifier of the root intent in the - chain of followup intents. It identifies the correct followup - intents chain for this intent. We populate this field only in - the output. Format: ``projects//agent/intents/``. - parent_followup_intent_name: - Read-only after creation. The unique identifier of the parent - intent in the chain of followup intents. You can set this - field when creating an intent, for example with [CreateIntent] - [google.cloud.dialogflow.v2.Intents.CreateIntent] or [BatchUpd - ateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateInte - nts], in order to make this intent a followup intent. It - identifies the parent followup intent. Format: - ``projects//agent/intents/``. - followup_intent_info: - Read-only. Information about all followup intents that have - this intent as a direct or indirect parent. We populate this - field only in the output. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Intent) - }, -) -_sym_db.RegisterMessage(Intent) -_sym_db.RegisterMessage(Intent.TrainingPhrase) -_sym_db.RegisterMessage(Intent.TrainingPhrase.Part) -_sym_db.RegisterMessage(Intent.Parameter) -_sym_db.RegisterMessage(Intent.Message) -_sym_db.RegisterMessage(Intent.Message.Text) -_sym_db.RegisterMessage(Intent.Message.Image) -_sym_db.RegisterMessage(Intent.Message.QuickReplies) -_sym_db.RegisterMessage(Intent.Message.Card) -_sym_db.RegisterMessage(Intent.Message.Card.Button) -_sym_db.RegisterMessage(Intent.Message.SimpleResponse) -_sym_db.RegisterMessage(Intent.Message.SimpleResponses) -_sym_db.RegisterMessage(Intent.Message.BasicCard) -_sym_db.RegisterMessage(Intent.Message.BasicCard.Button) -_sym_db.RegisterMessage(Intent.Message.BasicCard.Button.OpenUriAction) -_sym_db.RegisterMessage(Intent.Message.Suggestion) -_sym_db.RegisterMessage(Intent.Message.Suggestions) -_sym_db.RegisterMessage(Intent.Message.LinkOutSuggestion) -_sym_db.RegisterMessage(Intent.Message.ListSelect) -_sym_db.RegisterMessage(Intent.Message.ListSelect.Item) -_sym_db.RegisterMessage(Intent.Message.CarouselSelect) -_sym_db.RegisterMessage(Intent.Message.CarouselSelect.Item) -_sym_db.RegisterMessage(Intent.Message.SelectItemInfo) -_sym_db.RegisterMessage(Intent.Message.MediaContent) -_sym_db.RegisterMessage(Intent.Message.MediaContent.ResponseMediaObject) -_sym_db.RegisterMessage(Intent.Message.BrowseCarouselCard) -_sym_db.RegisterMessage(Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem) -_sym_db.RegisterMessage( - Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction -) -_sym_db.RegisterMessage(Intent.Message.TableCard) -_sym_db.RegisterMessage(Intent.Message.ColumnProperties) -_sym_db.RegisterMessage(Intent.Message.TableCardRow) -_sym_db.RegisterMessage(Intent.Message.TableCardCell) -_sym_db.RegisterMessage(Intent.FollowupIntentInfo) - -ListIntentsRequest = _reflection.GeneratedProtocolMessageType( - "ListIntentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTINTENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The request message for - [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. - - Attributes: - parent: - Required. The agent to list all intents from. Format: - ``projects//agent``. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - intent_view: - Optional. The resource view to apply to the returned intent. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ListIntentsRequest) - }, -) -_sym_db.RegisterMessage(ListIntentsRequest) - -ListIntentsResponse = _reflection.GeneratedProtocolMessageType( - "ListIntentsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTINTENTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The response message for - [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. - - Attributes: - intents: - The list of agent intents. There will be a maximum number of - items returned based on the page_size field in the request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ListIntentsResponse) - }, -) -_sym_db.RegisterMessage(ListIntentsResponse) - -GetIntentRequest = _reflection.GeneratedProtocolMessageType( - "GetIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The request message for - [Intents.GetIntent][google.cloud.dialogflow.v2.Intents.GetIntent]. - - Attributes: - name: - Required. The name of the intent. Format: ``projects//agent/intents/``. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - intent_view: - Optional. The resource view to apply to the returned intent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.GetIntentRequest) - }, -) -_sym_db.RegisterMessage(GetIntentRequest) - -CreateIntentRequest = _reflection.GeneratedProtocolMessageType( - "CreateIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The request message for [Intents.CreateIntent][google.cloud.dialogflow - .v2.Intents.CreateIntent]. - - Attributes: - parent: - Required. The agent to create a intent for. Format: - ``projects//agent``. - intent: - Required. The intent to create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - intent_view: - Optional. The resource view to apply to the returned intent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.CreateIntentRequest) - }, -) -_sym_db.RegisterMessage(CreateIntentRequest) - -UpdateIntentRequest = _reflection.GeneratedProtocolMessageType( - "UpdateIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The request message for [Intents.UpdateIntent][google.cloud.dialogflow - .v2.Intents.UpdateIntent]. - - Attributes: - intent: - Required. The intent to update. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - update_mask: - Optional. The mask to control which fields get updated. - intent_view: - Optional. The resource view to apply to the returned intent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.UpdateIntentRequest) - }, -) -_sym_db.RegisterMessage(UpdateIntentRequest) - -DeleteIntentRequest = _reflection.GeneratedProtocolMessageType( - "DeleteIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The request message for [Intents.DeleteIntent][google.cloud.dialogflow - .v2.Intents.DeleteIntent]. - - Attributes: - name: - Required. The name of the intent to delete. If this intent has - direct or indirect followup intents, we also delete them. - Format: ``projects//agent/intents/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.DeleteIntentRequest) - }, -) -_sym_db.RegisterMessage(DeleteIntentRequest) - -BatchUpdateIntentsRequest = _reflection.GeneratedProtocolMessageType( - "BatchUpdateIntentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEINTENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """Attributes: - parent: - Required. The name of the agent to update or create intents - in. Format: ``projects//agent``. - intent_batch: - The source of the intent batch. - intent_batch_uri: - The URI to a Google Cloud Storage file containing intents to - update or create. The file format can either be a serialized - proto (of IntentBatch type) or JSON object. Note: The URI must - start with “gs://”. - intent_batch_inline: - The collection of intents to update or create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - update_mask: - Optional. The mask to control which fields get updated. - intent_view: - Optional. The resource view to apply to the returned intent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.BatchUpdateIntentsRequest) - }, -) -_sym_db.RegisterMessage(BatchUpdateIntentsRequest) - -BatchUpdateIntentsResponse = _reflection.GeneratedProtocolMessageType( - "BatchUpdateIntentsResponse", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEINTENTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The response message for [Intents.BatchUpdateIntents][google.cloud.dia - logflow.v2.Intents.BatchUpdateIntents]. - - Attributes: - intents: - The collection of updated or created intents. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.BatchUpdateIntentsResponse) - }, -) -_sym_db.RegisterMessage(BatchUpdateIntentsResponse) - -BatchDeleteIntentsRequest = _reflection.GeneratedProtocolMessageType( - "BatchDeleteIntentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHDELETEINTENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """The request message for [Intents.BatchDeleteIntents][google.cloud.dial - ogflow.v2.Intents.BatchDeleteIntents]. - - Attributes: - parent: - Required. The name of the agent to delete all entities types - for. Format: ``projects//agent``. - intents: - Required. The collection of intents to delete. Only intent - ``name`` must be filled in. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.BatchDeleteIntentsRequest) - }, -) -_sym_db.RegisterMessage(BatchDeleteIntentsRequest) - -IntentBatch = _reflection.GeneratedProtocolMessageType( - "IntentBatch", - (_message.Message,), - { - "DESCRIPTOR": _INTENTBATCH, - "__module__": "google.cloud.dialogflow_v2.proto.intent_pb2", - "__doc__": """This message is a wrapper around a collection of intents. - - Attributes: - intents: - A collection of intents. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.IntentBatch) - }, -) -_sym_db.RegisterMessage(IntentBatch) - - -DESCRIPTOR._options = None -_INTENT_TRAININGPHRASE_PART.fields_by_name["entity_type"]._options = None -_INTENT_TRAININGPHRASE_PART.fields_by_name["alias"]._options = None -_INTENT_TRAININGPHRASE_PART.fields_by_name["user_defined"]._options = None -_INTENT_TRAININGPHRASE_TYPE.values_by_name["TEMPLATE"]._options = None -_INTENT_TRAININGPHRASE.fields_by_name["type"]._options = None -_INTENT_TRAININGPHRASE.fields_by_name["parts"]._options = None -_INTENT_TRAININGPHRASE.fields_by_name["times_added_count"]._options = None -_INTENT_PARAMETER.fields_by_name["value"]._options = None -_INTENT_PARAMETER.fields_by_name["default_value"]._options = None -_INTENT_PARAMETER.fields_by_name["entity_type_display_name"]._options = None -_INTENT_PARAMETER.fields_by_name["mandatory"]._options = None -_INTENT_PARAMETER.fields_by_name["prompts"]._options = None -_INTENT_PARAMETER.fields_by_name["is_list"]._options = None -_INTENT_MESSAGE_TEXT.fields_by_name["text"]._options = None -_INTENT_MESSAGE_IMAGE.fields_by_name["image_uri"]._options = None -_INTENT_MESSAGE_IMAGE.fields_by_name["accessibility_text"]._options = None -_INTENT_MESSAGE_QUICKREPLIES.fields_by_name["title"]._options = None -_INTENT_MESSAGE_QUICKREPLIES.fields_by_name["quick_replies"]._options = None -_INTENT_MESSAGE_CARD_BUTTON.fields_by_name["text"]._options = None -_INTENT_MESSAGE_CARD_BUTTON.fields_by_name["postback"]._options = None -_INTENT_MESSAGE_CARD.fields_by_name["title"]._options = None -_INTENT_MESSAGE_CARD.fields_by_name["subtitle"]._options = None -_INTENT_MESSAGE_CARD.fields_by_name["image_uri"]._options = None -_INTENT_MESSAGE_CARD.fields_by_name["buttons"]._options = None -_INTENT_MESSAGE_SIMPLERESPONSE.fields_by_name["display_text"]._options = None -_INTENT_MESSAGE_SIMPLERESPONSES.fields_by_name["simple_responses"]._options = None -_INTENT_MESSAGE_BASICCARD_BUTTON.fields_by_name["open_uri_action"]._options = None -_INTENT_MESSAGE_BASICCARD.fields_by_name["title"]._options = None -_INTENT_MESSAGE_BASICCARD.fields_by_name["subtitle"]._options = None -_INTENT_MESSAGE_BASICCARD.fields_by_name["image"]._options = None -_INTENT_MESSAGE_BASICCARD.fields_by_name["buttons"]._options = None -_INTENT_MESSAGE_SUGGESTION.fields_by_name["title"]._options = None -_INTENT_MESSAGE_SUGGESTIONS.fields_by_name["suggestions"]._options = None -_INTENT_MESSAGE_LINKOUTSUGGESTION.fields_by_name["destination_name"]._options = None -_INTENT_MESSAGE_LINKOUTSUGGESTION.fields_by_name["uri"]._options = None -_INTENT_MESSAGE_LISTSELECT_ITEM.fields_by_name["info"]._options = None -_INTENT_MESSAGE_LISTSELECT_ITEM.fields_by_name["title"]._options = None -_INTENT_MESSAGE_LISTSELECT_ITEM.fields_by_name["description"]._options = None -_INTENT_MESSAGE_LISTSELECT_ITEM.fields_by_name["image"]._options = None -_INTENT_MESSAGE_LISTSELECT.fields_by_name["title"]._options = None -_INTENT_MESSAGE_LISTSELECT.fields_by_name["items"]._options = None -_INTENT_MESSAGE_LISTSELECT.fields_by_name["subtitle"]._options = None -_INTENT_MESSAGE_CAROUSELSELECT_ITEM.fields_by_name["info"]._options = None -_INTENT_MESSAGE_CAROUSELSELECT_ITEM.fields_by_name["title"]._options = None -_INTENT_MESSAGE_CAROUSELSELECT_ITEM.fields_by_name["description"]._options = None -_INTENT_MESSAGE_CAROUSELSELECT_ITEM.fields_by_name["image"]._options = None -_INTENT_MESSAGE_CAROUSELSELECT.fields_by_name["items"]._options = None -_INTENT_MESSAGE_SELECTITEMINFO.fields_by_name["key"]._options = None -_INTENT_MESSAGE_SELECTITEMINFO.fields_by_name["synonyms"]._options = None -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name[ - "description" -]._options = None -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name[ - "large_image" -]._options = None -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name["icon"]._options = None -_INTENT_MESSAGE_MEDIACONTENT.fields_by_name["media_type"]._options = None -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION.fields_by_name[ - "url_type_hint" -]._options = None -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM.fields_by_name[ - "description" -]._options = None -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM.fields_by_name[ - "image" -]._options = None -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM.fields_by_name[ - "footer" -]._options = None -_INTENT_MESSAGE_BROWSECAROUSELCARD.fields_by_name[ - "image_display_options" -]._options = None -_INTENT_MESSAGE_TABLECARD.fields_by_name["subtitle"]._options = None -_INTENT_MESSAGE_TABLECARD.fields_by_name["image"]._options = None -_INTENT_MESSAGE_TABLECARD.fields_by_name["column_properties"]._options = None -_INTENT_MESSAGE_TABLECARD.fields_by_name["rows"]._options = None -_INTENT_MESSAGE_TABLECARD.fields_by_name["buttons"]._options = None -_INTENT_MESSAGE_COLUMNPROPERTIES.fields_by_name["horizontal_alignment"]._options = None -_INTENT_MESSAGE_TABLECARDROW.fields_by_name["cells"]._options = None -_INTENT_MESSAGE_TABLECARDROW.fields_by_name["divider_after"]._options = None -_INTENT_MESSAGE.fields_by_name["platform"]._options = None -_INTENT.fields_by_name["name"]._options = None -_INTENT.fields_by_name["display_name"]._options = None -_INTENT.fields_by_name["webhook_state"]._options = None -_INTENT.fields_by_name["priority"]._options = None -_INTENT.fields_by_name["is_fallback"]._options = None -_INTENT.fields_by_name["ml_disabled"]._options = None -_INTENT.fields_by_name["input_context_names"]._options = None -_INTENT.fields_by_name["events"]._options = None -_INTENT.fields_by_name["training_phrases"]._options = None -_INTENT.fields_by_name["action"]._options = None -_INTENT.fields_by_name["output_contexts"]._options = None -_INTENT.fields_by_name["reset_contexts"]._options = None -_INTENT.fields_by_name["parameters"]._options = None -_INTENT.fields_by_name["messages"]._options = None -_INTENT.fields_by_name["default_response_platforms"]._options = None -_INTENT._options = None -_LISTINTENTSREQUEST.fields_by_name["parent"]._options = None -_LISTINTENTSREQUEST.fields_by_name["language_code"]._options = None -_LISTINTENTSREQUEST.fields_by_name["intent_view"]._options = None -_LISTINTENTSREQUEST.fields_by_name["page_size"]._options = None -_LISTINTENTSREQUEST.fields_by_name["page_token"]._options = None -_GETINTENTREQUEST.fields_by_name["name"]._options = None -_GETINTENTREQUEST.fields_by_name["language_code"]._options = None -_GETINTENTREQUEST.fields_by_name["intent_view"]._options = None -_CREATEINTENTREQUEST.fields_by_name["parent"]._options = None -_CREATEINTENTREQUEST.fields_by_name["intent"]._options = None -_CREATEINTENTREQUEST.fields_by_name["language_code"]._options = None -_CREATEINTENTREQUEST.fields_by_name["intent_view"]._options = None -_UPDATEINTENTREQUEST.fields_by_name["intent"]._options = None -_UPDATEINTENTREQUEST.fields_by_name["language_code"]._options = None -_UPDATEINTENTREQUEST.fields_by_name["update_mask"]._options = None -_UPDATEINTENTREQUEST.fields_by_name["intent_view"]._options = None -_DELETEINTENTREQUEST.fields_by_name["name"]._options = None -_BATCHUPDATEINTENTSREQUEST.fields_by_name["parent"]._options = None -_BATCHUPDATEINTENTSREQUEST.fields_by_name["language_code"]._options = None -_BATCHUPDATEINTENTSREQUEST.fields_by_name["update_mask"]._options = None -_BATCHUPDATEINTENTSREQUEST.fields_by_name["intent_view"]._options = None -_BATCHDELETEINTENTSREQUEST.fields_by_name["parent"]._options = None -_BATCHDELETEINTENTSREQUEST.fields_by_name["intents"]._options = None - -_INTENTS = _descriptor.ServiceDescriptor( - name="Intents", - full_name="google.cloud.dialogflow.v2.Intents", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=9326, - serialized_end=10936, - methods=[ - _descriptor.MethodDescriptor( - name="ListIntents", - full_name="google.cloud.dialogflow.v2.Intents.ListIntents", - index=0, - containing_service=None, - input_type=_LISTINTENTSREQUEST, - output_type=_LISTINTENTSRESPONSE, - serialized_options=b"\202\323\344\223\002'\022%/v2/{parent=projects/*/agent}/intents\332A\006parent\332A\024parent,language_code", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetIntent", - full_name="google.cloud.dialogflow.v2.Intents.GetIntent", - index=1, - containing_service=None, - input_type=_GETINTENTREQUEST, - output_type=_INTENT, - serialized_options=b"\202\323\344\223\002'\022%/v2/{name=projects/*/agent/intents/*}\332A\004name\332A\022name,language_code", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateIntent", - full_name="google.cloud.dialogflow.v2.Intents.CreateIntent", - index=2, - containing_service=None, - input_type=_CREATEINTENTREQUEST, - output_type=_INTENT, - serialized_options=b'\202\323\344\223\002/"%/v2/{parent=projects/*/agent}/intents:\006intent\332A\rparent,intent\332A\033parent,intent,language_code', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateIntent", - full_name="google.cloud.dialogflow.v2.Intents.UpdateIntent", - index=3, - containing_service=None, - input_type=_UPDATEINTENTREQUEST, - output_type=_INTENT, - serialized_options=b"\202\323\344\223\00262,/v2/{intent.name=projects/*/agent/intents/*}:\006intent\332A\024intent,language_code\332A intent,language_code,update_mask", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteIntent", - full_name="google.cloud.dialogflow.v2.Intents.DeleteIntent", - index=4, - containing_service=None, - input_type=_DELETEINTENTREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002'*%/v2/{name=projects/*/agent/intents/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchUpdateIntents", - full_name="google.cloud.dialogflow.v2.Intents.BatchUpdateIntents", - index=5, - containing_service=None, - input_type=_BATCHUPDATEINTENTSREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\0026"1/v2/{parent=projects/*/agent}/intents:batchUpdate:\001*\332A\027parent,intent_batch_uri\332A\032parent,intent_batch_inline\312AO\n5google.cloud.dialogflow.v2.BatchUpdateIntentsResponse\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchDeleteIntents", - full_name="google.cloud.dialogflow.v2.Intents.BatchDeleteIntents", - index=6, - containing_service=None, - input_type=_BATCHDELETEINTENTSREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\0026"1/v2/{parent=projects/*/agent}/intents:batchDelete:\001*\332A\016parent,intents\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_INTENTS) - -DESCRIPTOR.services_by_name["Intents"] = _INTENTS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2/proto/intent_pb2_grpc.py b/dialogflow_v2/proto/intent_pb2_grpc.py deleted file mode 100644 index 8ab7696ad..000000000 --- a/dialogflow_v2/proto/intent_pb2_grpc.py +++ /dev/null @@ -1,356 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2.proto import ( - intent_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class IntentsStub(object): - """Service for managing [Intents][google.cloud.dialogflow.v2.Intent]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListIntents = channel.unary_unary( - "/google.cloud.dialogflow.v2.Intents/ListIntents", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.ListIntentsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.ListIntentsResponse.FromString, - ) - self.GetIntent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Intents/GetIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.GetIntentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.Intent.FromString, - ) - self.CreateIntent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Intents/CreateIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.CreateIntentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.Intent.FromString, - ) - self.UpdateIntent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Intents/UpdateIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.UpdateIntentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.Intent.FromString, - ) - self.DeleteIntent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Intents/DeleteIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.DeleteIntentRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.BatchUpdateIntents = channel.unary_unary( - "/google.cloud.dialogflow.v2.Intents/BatchUpdateIntents", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.BatchUpdateIntentsRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.BatchDeleteIntents = channel.unary_unary( - "/google.cloud.dialogflow.v2.Intents/BatchDeleteIntents", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.BatchDeleteIntentsRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - - -class IntentsServicer(object): - """Service for managing [Intents][google.cloud.dialogflow.v2.Intent]. - """ - - def ListIntents(self, request, context): - """Returns the list of all intents in the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetIntent(self, request, context): - """Retrieves the specified intent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateIntent(self, request, context): - """Creates an intent in the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateIntent(self, request, context): - """Updates the specified intent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteIntent(self, request, context): - """Deletes the specified intent and its direct or indirect followup intents. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchUpdateIntents(self, request, context): - """Updates/Creates multiple intents in the specified agent. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchDeleteIntents(self, request, context): - """Deletes intents in the specified agent. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_IntentsServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListIntents": grpc.unary_unary_rpc_method_handler( - servicer.ListIntents, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.ListIntentsRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.ListIntentsResponse.SerializeToString, - ), - "GetIntent": grpc.unary_unary_rpc_method_handler( - servicer.GetIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.GetIntentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.Intent.SerializeToString, - ), - "CreateIntent": grpc.unary_unary_rpc_method_handler( - servicer.CreateIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.CreateIntentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.Intent.SerializeToString, - ), - "UpdateIntent": grpc.unary_unary_rpc_method_handler( - servicer.UpdateIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.UpdateIntentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.Intent.SerializeToString, - ), - "DeleteIntent": grpc.unary_unary_rpc_method_handler( - servicer.DeleteIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.DeleteIntentRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "BatchUpdateIntents": grpc.unary_unary_rpc_method_handler( - servicer.BatchUpdateIntents, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.BatchUpdateIntentsRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "BatchDeleteIntents": grpc.unary_unary_rpc_method_handler( - servicer.BatchDeleteIntents, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.BatchDeleteIntentsRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2.Intents", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Intents(object): - """Service for managing [Intents][google.cloud.dialogflow.v2.Intent]. - """ - - @staticmethod - def ListIntents( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Intents/ListIntents", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.ListIntentsRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.ListIntentsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetIntent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Intents/GetIntent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.GetIntentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.Intent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateIntent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Intents/CreateIntent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.CreateIntentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.Intent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateIntent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Intents/UpdateIntent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.UpdateIntentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.Intent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteIntent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Intents/DeleteIntent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.DeleteIntentRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchUpdateIntents( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Intents/BatchUpdateIntents", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.BatchUpdateIntentsRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchDeleteIntents( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Intents/BatchDeleteIntents", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.BatchDeleteIntentsRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2/proto/session_entity_type_pb2.py b/dialogflow_v2/proto/session_entity_type_pb2.py deleted file mode 100644 index 678c7f91c..000000000 --- a/dialogflow_v2/proto/session_entity_type_pb2.py +++ /dev/null @@ -1,813 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2/proto/session_entity_type.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from dialogflow_v2.proto import ( - entity_type_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2/proto/session_entity_type.proto", - package="google.cloud.dialogflow.v2", - syntax="proto3", - serialized_options=b"\n\036com.google.cloud.dialogflow.v2B\026SessionEntityTypeProtoP\001ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cloud.Dialogflow.V2", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n:google/cloud/dialogflow_v2/proto/session_entity_type.proto\x12\x1agoogle.cloud.dialogflow.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x32google/cloud/dialogflow_v2/proto/entity_type.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\xc0\x04\n\x11SessionEntityType\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x63\n\x14\x65ntity_override_mode\x18\x02 \x01(\x0e\x32@.google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideModeB\x03\xe0\x41\x02\x12\x44\n\x08\x65ntities\x18\x03 \x03(\x0b\x32-.google.cloud.dialogflow.v2.EntityType.EntityB\x03\xe0\x41\x02"\x82\x01\n\x12\x45ntityOverrideMode\x12$\n ENTITY_OVERRIDE_MODE_UNSPECIFIED\x10\x00\x12!\n\x1d\x45NTITY_OVERRIDE_MODE_OVERRIDE\x10\x01\x12#\n\x1f\x45NTITY_OVERRIDE_MODE_SUPPLEMENT\x10\x02:\xe7\x01\xea\x41\xe3\x01\n+dialogflow.googleapis.com/SessionEntityType\x12\x45projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}\x12mprojects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}"\x95\x01\n\x1dListSessionEntityTypesRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\x12+dialogflow.googleapis.com/SessionEntityType\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01"\x86\x01\n\x1eListSessionEntityTypesResponse\x12K\n\x14session_entity_types\x18\x01 \x03(\x0b\x32-.google.cloud.dialogflow.v2.SessionEntityType\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"`\n\x1bGetSessionEntityTypeRequest\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+dialogflow.googleapis.com/SessionEntityType"\xb6\x01\n\x1e\x43reateSessionEntityTypeRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\x12+dialogflow.googleapis.com/SessionEntityType\x12O\n\x13session_entity_type\x18\x02 \x01(\x0b\x32-.google.cloud.dialogflow.v2.SessionEntityTypeB\x03\xe0\x41\x02"\xa7\x01\n\x1eUpdateSessionEntityTypeRequest\x12O\n\x13session_entity_type\x18\x01 \x01(\x0b\x32-.google.cloud.dialogflow.v2.SessionEntityTypeB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01"c\n\x1e\x44\x65leteSessionEntityTypeRequest\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+dialogflow.googleapis.com/SessionEntityType2\xd2\r\n\x12SessionEntityTypes\x12\xa7\x02\n\x16ListSessionEntityTypes\x12\x39.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest\x1a:.google.cloud.dialogflow.v2.ListSessionEntityTypesResponse"\x95\x01\x82\xd3\xe4\x93\x02\x85\x01\x12\x34/v2/{parent=projects/*/agent/sessions/*}/entityTypesZM\x12K/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes\xda\x41\x06parent\x12\x94\x02\n\x14GetSessionEntityType\x12\x37.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest\x1a-.google.cloud.dialogflow.v2.SessionEntityType"\x93\x01\x82\xd3\xe4\x93\x02\x85\x01\x12\x34/v2/{name=projects/*/agent/sessions/*/entityTypes/*}ZM\x12K/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}\xda\x41\x04name\x12\xda\x02\n\x17\x43reateSessionEntityType\x12:.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest\x1a-.google.cloud.dialogflow.v2.SessionEntityType"\xd3\x01\x82\xd3\xe4\x93\x02\xaf\x01"4/v2/{parent=projects/*/agent/sessions/*}/entityTypes:\x13session_entity_typeZb"K/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes:\x13session_entity_type\xda\x41\x1aparent,session_entity_type\x12\x9d\x03\n\x17UpdateSessionEntityType\x12:.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest\x1a-.google.cloud.dialogflow.v2.SessionEntityType"\x96\x02\x82\xd3\xe4\x93\x02\xd7\x01\x32H/v2/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}:\x13session_entity_typeZv2_/v2/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}:\x13session_entity_type\xda\x41\x13session_entity_type\xda\x41\x1fsession_entity_type,update_mask\x12\x83\x02\n\x17\x44\x65leteSessionEntityType\x12:.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest\x1a\x16.google.protobuf.Empty"\x93\x01\x82\xd3\xe4\x93\x02\x85\x01*4/v2/{name=projects/*/agent/sessions/*/entityTypes/*}ZM*K/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}\xda\x41\x04name\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\xa5\x01\n\x1e\x63om.google.cloud.dialogflow.v2B\x16SessionEntityTypeProtoP\x01ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1aGoogle.Cloud.Dialogflow.V2b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - ], -) - - -_SESSIONENTITYTYPE_ENTITYOVERRIDEMODE = _descriptor.EnumDescriptor( - name="EntityOverrideMode", - full_name="google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="ENTITY_OVERRIDE_MODE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ENTITY_OVERRIDE_MODE_OVERRIDE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ENTITY_OVERRIDE_MODE_SUPPLEMENT", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=533, - serialized_end=663, -) -_sym_db.RegisterEnumDescriptor(_SESSIONENTITYTYPE_ENTITYOVERRIDEMODE) - - -_SESSIONENTITYTYPE = _descriptor.Descriptor( - name="SessionEntityType", - full_name="google.cloud.dialogflow.v2.SessionEntityType", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.SessionEntityType.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_override_mode", - full_name="google.cloud.dialogflow.v2.SessionEntityType.entity_override_mode", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entities", - full_name="google.cloud.dialogflow.v2.SessionEntityType.entities", - index=2, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_SESSIONENTITYTYPE_ENTITYOVERRIDEMODE], - serialized_options=b"\352A\343\001\n+dialogflow.googleapis.com/SessionEntityType\022Eprojects/{project}/agent/sessions/{session}/entityTypes/{entity_type}\022mprojects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=321, - serialized_end=897, -) - - -_LISTSESSIONENTITYTYPESREQUEST = _descriptor.Descriptor( - name="ListSessionEntityTypesRequest", - full_name="google.cloud.dialogflow.v2.ListSessionEntityTypesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.ListSessionEntityTypesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\022+dialogflow.googleapis.com/SessionEntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2.ListSessionEntityTypesRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2.ListSessionEntityTypesRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=900, - serialized_end=1049, -) - - -_LISTSESSIONENTITYTYPESRESPONSE = _descriptor.Descriptor( - name="ListSessionEntityTypesResponse", - full_name="google.cloud.dialogflow.v2.ListSessionEntityTypesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="session_entity_types", - full_name="google.cloud.dialogflow.v2.ListSessionEntityTypesResponse.session_entity_types", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2.ListSessionEntityTypesResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1052, - serialized_end=1186, -) - - -_GETSESSIONENTITYTYPEREQUEST = _descriptor.Descriptor( - name="GetSessionEntityTypeRequest", - full_name="google.cloud.dialogflow.v2.GetSessionEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.GetSessionEntityTypeRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\n+dialogflow.googleapis.com/SessionEntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1188, - serialized_end=1284, -) - - -_CREATESESSIONENTITYTYPEREQUEST = _descriptor.Descriptor( - name="CreateSessionEntityTypeRequest", - full_name="google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\022+dialogflow.googleapis.com/SessionEntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="session_entity_type", - full_name="google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest.session_entity_type", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1287, - serialized_end=1469, -) - - -_UPDATESESSIONENTITYTYPEREQUEST = _descriptor.Descriptor( - name="UpdateSessionEntityTypeRequest", - full_name="google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="session_entity_type", - full_name="google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest.session_entity_type", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1472, - serialized_end=1639, -) - - -_DELETESESSIONENTITYTYPEREQUEST = _descriptor.Descriptor( - name="DeleteSessionEntityTypeRequest", - full_name="google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\n+dialogflow.googleapis.com/SessionEntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1641, - serialized_end=1740, -) - -_SESSIONENTITYTYPE.fields_by_name[ - "entity_override_mode" -].enum_type = _SESSIONENTITYTYPE_ENTITYOVERRIDEMODE -_SESSIONENTITYTYPE.fields_by_name[ - "entities" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_entity__type__pb2._ENTITYTYPE_ENTITY -) -_SESSIONENTITYTYPE_ENTITYOVERRIDEMODE.containing_type = _SESSIONENTITYTYPE -_LISTSESSIONENTITYTYPESRESPONSE.fields_by_name[ - "session_entity_types" -].message_type = _SESSIONENTITYTYPE -_CREATESESSIONENTITYTYPEREQUEST.fields_by_name[ - "session_entity_type" -].message_type = _SESSIONENTITYTYPE -_UPDATESESSIONENTITYTYPEREQUEST.fields_by_name[ - "session_entity_type" -].message_type = _SESSIONENTITYTYPE -_UPDATESESSIONENTITYTYPEREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -DESCRIPTOR.message_types_by_name["SessionEntityType"] = _SESSIONENTITYTYPE -DESCRIPTOR.message_types_by_name[ - "ListSessionEntityTypesRequest" -] = _LISTSESSIONENTITYTYPESREQUEST -DESCRIPTOR.message_types_by_name[ - "ListSessionEntityTypesResponse" -] = _LISTSESSIONENTITYTYPESRESPONSE -DESCRIPTOR.message_types_by_name[ - "GetSessionEntityTypeRequest" -] = _GETSESSIONENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name[ - "CreateSessionEntityTypeRequest" -] = _CREATESESSIONENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name[ - "UpdateSessionEntityTypeRequest" -] = _UPDATESESSIONENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name[ - "DeleteSessionEntityTypeRequest" -] = _DELETESESSIONENTITYTYPEREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -SessionEntityType = _reflection.GeneratedProtocolMessageType( - "SessionEntityType", - (_message.Message,), - { - "DESCRIPTOR": _SESSIONENTITYTYPE, - "__module__": "google.cloud.dialogflow_v2.proto.session_entity_type_pb2", - "__doc__": """A session represents a conversation between a Dialogflow agent and an - end-user. You can create special entities, called session entities, - during a session. Session entities can extend or replace custom entity - types and only exist during the session that they were created for. - All session data, including session entities, is stored by Dialogflow - for 20 minutes. For more information, see the `session entity guide - `__. - - Attributes: - name: - Required. The unique identifier of this session entity type. - Format: ``projects//agent/sessions//entityTypes/``, or - ``projects//agent/environments//users//sessions//entityTypes/``. If ``Environment ID`` is not specified, - we assume default ‘draft’ environment. If ``User ID`` is not - specified, we assume default ‘-’ user. ```` must be the display name of an existing entity type in - the same agent that will be overridden or supplemented. - entity_override_mode: - Required. Indicates whether the additional data should - override or supplement the custom entity type definition. - entities: - Required. The collection of entities associated with this - session entity type. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.SessionEntityType) - }, -) -_sym_db.RegisterMessage(SessionEntityType) - -ListSessionEntityTypesRequest = _reflection.GeneratedProtocolMessageType( - "ListSessionEntityTypesRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTSESSIONENTITYTYPESREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.session_entity_type_pb2", - "__doc__": """The request message for [SessionEntityTypes.ListSessionEntityTypes][go - ogle.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. - - Attributes: - parent: - Required. The session to list all session entity types from. - Format: ``projects//agent/sessions/`` - or ``projects//agent/environments//users// sessions/``. If ``Environment - ID`` is not specified, we assume default ‘draft’ environment. - If ``User ID`` is not specified, we assume default ‘-’ user. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ListSessionEntityTypesRequest) - }, -) -_sym_db.RegisterMessage(ListSessionEntityTypesRequest) - -ListSessionEntityTypesResponse = _reflection.GeneratedProtocolMessageType( - "ListSessionEntityTypesResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTSESSIONENTITYTYPESRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.session_entity_type_pb2", - "__doc__": """The response message for [SessionEntityTypes.ListSessionEntityTypes][g - oogle.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. - - Attributes: - session_entity_types: - The list of session entity types. There will be a maximum - number of items returned based on the page_size field in the - request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ListSessionEntityTypesResponse) - }, -) -_sym_db.RegisterMessage(ListSessionEntityTypesResponse) - -GetSessionEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "GetSessionEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETSESSIONENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.session_entity_type_pb2", - "__doc__": """The request message for [SessionEntityTypes.GetSessionEntityType][goog - le.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType]. - - Attributes: - name: - Required. The name of the session entity type. Format: - ``projects//agent/sessions//entityTypes/`` or - ``projects//agent/environments//users//sessions//entityTypes/``. If ``Environment ID`` is not specified, - we assume default ‘draft’ environment. If ``User ID`` is not - specified, we assume default ‘-’ user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.GetSessionEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(GetSessionEntityTypeRequest) - -CreateSessionEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "CreateSessionEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATESESSIONENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.session_entity_type_pb2", - "__doc__": """The request message for [SessionEntityTypes.CreateSessionEntityType][g - oogle.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType]. - - Attributes: - parent: - Required. The session to create a session entity type for. - Format: ``projects//agent/sessions/`` - or ``projects//agent/environments//users// sessions/``. If ``Environment - ID`` is not specified, we assume default ‘draft’ environment. - If ``User ID`` is not specified, we assume default ‘-’ user. - session_entity_type: - Required. The session entity type to create. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(CreateSessionEntityTypeRequest) - -UpdateSessionEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "UpdateSessionEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATESESSIONENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.session_entity_type_pb2", - "__doc__": """The request message for [SessionEntityTypes.UpdateSessionEntityType][g - oogle.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType]. - - Attributes: - session_entity_type: - Required. The session entity type to update. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(UpdateSessionEntityTypeRequest) - -DeleteSessionEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "DeleteSessionEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETESESSIONENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.session_entity_type_pb2", - "__doc__": """The request message for [SessionEntityTypes.DeleteSessionEntityType][g - oogle.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType]. - - Attributes: - name: - Required. The name of the entity type to delete. Format: - ``projects//agent/sessions//entityTypes/`` or - ``projects//agent/environments//users//sessions//entityTypes/``. If ``Environment ID`` is not specified, - we assume default ‘draft’ environment. If ``User ID`` is not - specified, we assume default ‘-’ user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(DeleteSessionEntityTypeRequest) - - -DESCRIPTOR._options = None -_SESSIONENTITYTYPE.fields_by_name["name"]._options = None -_SESSIONENTITYTYPE.fields_by_name["entity_override_mode"]._options = None -_SESSIONENTITYTYPE.fields_by_name["entities"]._options = None -_SESSIONENTITYTYPE._options = None -_LISTSESSIONENTITYTYPESREQUEST.fields_by_name["parent"]._options = None -_LISTSESSIONENTITYTYPESREQUEST.fields_by_name["page_size"]._options = None -_LISTSESSIONENTITYTYPESREQUEST.fields_by_name["page_token"]._options = None -_GETSESSIONENTITYTYPEREQUEST.fields_by_name["name"]._options = None -_CREATESESSIONENTITYTYPEREQUEST.fields_by_name["parent"]._options = None -_CREATESESSIONENTITYTYPEREQUEST.fields_by_name["session_entity_type"]._options = None -_UPDATESESSIONENTITYTYPEREQUEST.fields_by_name["session_entity_type"]._options = None -_UPDATESESSIONENTITYTYPEREQUEST.fields_by_name["update_mask"]._options = None -_DELETESESSIONENTITYTYPEREQUEST.fields_by_name["name"]._options = None - -_SESSIONENTITYTYPES = _descriptor.ServiceDescriptor( - name="SessionEntityTypes", - full_name="google.cloud.dialogflow.v2.SessionEntityTypes", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=1743, - serialized_end=3489, - methods=[ - _descriptor.MethodDescriptor( - name="ListSessionEntityTypes", - full_name="google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes", - index=0, - containing_service=None, - input_type=_LISTSESSIONENTITYTYPESREQUEST, - output_type=_LISTSESSIONENTITYTYPESRESPONSE, - serialized_options=b"\202\323\344\223\002\205\001\0224/v2/{parent=projects/*/agent/sessions/*}/entityTypesZM\022K/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetSessionEntityType", - full_name="google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType", - index=1, - containing_service=None, - input_type=_GETSESSIONENTITYTYPEREQUEST, - output_type=_SESSIONENTITYTYPE, - serialized_options=b"\202\323\344\223\002\205\001\0224/v2/{name=projects/*/agent/sessions/*/entityTypes/*}ZM\022K/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateSessionEntityType", - full_name="google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType", - index=2, - containing_service=None, - input_type=_CREATESESSIONENTITYTYPEREQUEST, - output_type=_SESSIONENTITYTYPE, - serialized_options=b'\202\323\344\223\002\257\001"4/v2/{parent=projects/*/agent/sessions/*}/entityTypes:\023session_entity_typeZb"K/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes:\023session_entity_type\332A\032parent,session_entity_type', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateSessionEntityType", - full_name="google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType", - index=3, - containing_service=None, - input_type=_UPDATESESSIONENTITYTYPEREQUEST, - output_type=_SESSIONENTITYTYPE, - serialized_options=b"\202\323\344\223\002\327\0012H/v2/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}:\023session_entity_typeZv2_/v2/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}:\023session_entity_type\332A\023session_entity_type\332A\037session_entity_type,update_mask", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteSessionEntityType", - full_name="google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType", - index=4, - containing_service=None, - input_type=_DELETESESSIONENTITYTYPEREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002\205\001*4/v2/{name=projects/*/agent/sessions/*/entityTypes/*}ZM*K/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_SESSIONENTITYTYPES) - -DESCRIPTOR.services_by_name["SessionEntityTypes"] = _SESSIONENTITYTYPES - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2/proto/session_entity_type_pb2_grpc.py b/dialogflow_v2/proto/session_entity_type_pb2_grpc.py deleted file mode 100644 index 294ecf527..000000000 --- a/dialogflow_v2/proto/session_entity_type_pb2_grpc.py +++ /dev/null @@ -1,283 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2.proto import ( - session_entity_type_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class SessionEntityTypesStub(object): - """Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListSessionEntityTypes = channel.unary_unary( - "/google.cloud.dialogflow.v2.SessionEntityTypes/ListSessionEntityTypes", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesResponse.FromString, - ) - self.GetSessionEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2.SessionEntityTypes/GetSessionEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.GetSessionEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - ) - self.CreateSessionEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2.SessionEntityTypes/CreateSessionEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.CreateSessionEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - ) - self.UpdateSessionEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2.SessionEntityTypes/UpdateSessionEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.UpdateSessionEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - ) - self.DeleteSessionEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2.SessionEntityTypes/DeleteSessionEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.DeleteSessionEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - - -class SessionEntityTypesServicer(object): - """Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType]. - """ - - def ListSessionEntityTypes(self, request, context): - """Returns the list of all session entity types in the specified session. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetSessionEntityType(self, request, context): - """Retrieves the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateSessionEntityType(self, request, context): - """Creates a session entity type. - - If the specified session entity type already exists, overrides the session - entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateSessionEntityType(self, request, context): - """Updates the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteSessionEntityType(self, request, context): - """Deletes the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_SessionEntityTypesServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListSessionEntityTypes": grpc.unary_unary_rpc_method_handler( - servicer.ListSessionEntityTypes, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesResponse.SerializeToString, - ), - "GetSessionEntityType": grpc.unary_unary_rpc_method_handler( - servicer.GetSessionEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.GetSessionEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.SessionEntityType.SerializeToString, - ), - "CreateSessionEntityType": grpc.unary_unary_rpc_method_handler( - servicer.CreateSessionEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.CreateSessionEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.SessionEntityType.SerializeToString, - ), - "UpdateSessionEntityType": grpc.unary_unary_rpc_method_handler( - servicer.UpdateSessionEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.UpdateSessionEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.SessionEntityType.SerializeToString, - ), - "DeleteSessionEntityType": grpc.unary_unary_rpc_method_handler( - servicer.DeleteSessionEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.DeleteSessionEntityTypeRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2.SessionEntityTypes", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class SessionEntityTypes(object): - """Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType]. - """ - - @staticmethod - def ListSessionEntityTypes( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.SessionEntityTypes/ListSessionEntityTypes", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetSessionEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.SessionEntityTypes/GetSessionEntityType", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.GetSessionEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateSessionEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.SessionEntityTypes/CreateSessionEntityType", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.CreateSessionEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateSessionEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.SessionEntityTypes/UpdateSessionEntityType", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.UpdateSessionEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteSessionEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.SessionEntityTypes/DeleteSessionEntityType", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.DeleteSessionEntityTypeRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2/proto/session_pb2.py b/dialogflow_v2/proto/session_pb2.py deleted file mode 100644 index b257bea47..000000000 --- a/dialogflow_v2/proto/session_pb2.py +++ /dev/null @@ -1,2399 +0,0 @@ -# -*- coding: utf-8 -*- -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2/proto/session.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from dialogflow_v2.proto import ( - audio_config_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_audio__config__pb2, -) -from dialogflow_v2.proto import ( - context_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2, -) -from dialogflow_v2.proto import ( - intent_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2, -) -from dialogflow_v2.proto import ( - session_entity_type_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2, -) -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 -from google.rpc import status_pb2 as google_dot_rpc_dot_status__pb2 -from google.type import latlng_pb2 as google_dot_type_dot_latlng__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2/proto/session.proto", - package="google.cloud.dialogflow.v2", - syntax="proto3", - serialized_options=b"\n\036com.google.cloud.dialogflow.v2B\014SessionProtoP\001ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cloud.Dialogflow.V2\352A\245\001\n!dialogflow.googleapis.com/Session\022+projects/{project}/agent/sessions/{session}\022Sprojects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n.google/cloud/dialogflow_v2/proto/session.proto\x12\x1agoogle.cloud.dialogflow.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x33google/cloud/dialogflow_v2/proto/audio_config.proto\x1a.google/cloud/dialogflow_v2/proto/context.proto\x1a-google/cloud/dialogflow_v2/proto/intent.proto\x1a:google/cloud/dialogflow_v2/proto/session_entity_type.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x17google/rpc/status.proto\x1a\x18google/type/latlng.proto"\xf5\x02\n\x13\x44\x65tectIntentRequest\x12:\n\x07session\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!dialogflow.googleapis.com/Session\x12\x41\n\x0cquery_params\x18\x02 \x01(\x0b\x32+.google.cloud.dialogflow.v2.QueryParameters\x12@\n\x0bquery_input\x18\x03 \x01(\x0b\x32&.google.cloud.dialogflow.v2.QueryInputB\x03\xe0\x41\x02\x12J\n\x13output_audio_config\x18\x04 \x01(\x0b\x32-.google.cloud.dialogflow.v2.OutputAudioConfig\x12<\n\x18output_audio_config_mask\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x13\n\x0binput_audio\x18\x05 \x01(\x0c"\xf8\x01\n\x14\x44\x65tectIntentResponse\x12\x13\n\x0bresponse_id\x18\x01 \x01(\t\x12=\n\x0cquery_result\x18\x02 \x01(\x0b\x32\'.google.cloud.dialogflow.v2.QueryResult\x12*\n\x0ewebhook_status\x18\x03 \x01(\x0b\x32\x12.google.rpc.Status\x12\x14\n\x0coutput_audio\x18\x04 \x01(\x0c\x12J\n\x13output_audio_config\x18\x06 \x01(\x0b\x32-.google.cloud.dialogflow.v2.OutputAudioConfig"\xfc\x02\n\x0fQueryParameters\x12\x11\n\ttime_zone\x18\x01 \x01(\t\x12)\n\x0cgeo_location\x18\x02 \x01(\x0b\x32\x13.google.type.LatLng\x12\x35\n\x08\x63ontexts\x18\x03 \x03(\x0b\x32#.google.cloud.dialogflow.v2.Context\x12\x16\n\x0ereset_contexts\x18\x04 \x01(\x08\x12K\n\x14session_entity_types\x18\x05 \x03(\x0b\x32-.google.cloud.dialogflow.v2.SessionEntityType\x12(\n\x07payload\x18\x06 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x65\n!sentiment_analysis_request_config\x18\n \x01(\x0b\x32:.google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig"\xcb\x01\n\nQueryInput\x12\x44\n\x0c\x61udio_config\x18\x01 \x01(\x0b\x32,.google.cloud.dialogflow.v2.InputAudioConfigH\x00\x12\x35\n\x04text\x18\x02 \x01(\x0b\x32%.google.cloud.dialogflow.v2.TextInputH\x00\x12\x37\n\x05\x65vent\x18\x03 \x01(\x0b\x32&.google.cloud.dialogflow.v2.EventInputH\x00\x42\x07\n\x05input"\x90\x05\n\x0bQueryResult\x12\x12\n\nquery_text\x18\x01 \x01(\t\x12\x15\n\rlanguage_code\x18\x0f \x01(\t\x12%\n\x1dspeech_recognition_confidence\x18\x02 \x01(\x02\x12\x0e\n\x06\x61\x63tion\x18\x03 \x01(\t\x12+\n\nparameters\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12#\n\x1b\x61ll_required_params_present\x18\x05 \x01(\x08\x12\x18\n\x10\x66ulfillment_text\x18\x06 \x01(\t\x12H\n\x14\x66ulfillment_messages\x18\x07 \x03(\x0b\x32*.google.cloud.dialogflow.v2.Intent.Message\x12\x16\n\x0ewebhook_source\x18\x08 \x01(\t\x12\x30\n\x0fwebhook_payload\x18\t \x01(\x0b\x32\x17.google.protobuf.Struct\x12<\n\x0foutput_contexts\x18\n \x03(\x0b\x32#.google.cloud.dialogflow.v2.Context\x12\x32\n\x06intent\x18\x0b \x01(\x0b\x32".google.cloud.dialogflow.v2.Intent\x12#\n\x1bintent_detection_confidence\x18\x0c \x01(\x02\x12\x30\n\x0f\x64iagnostic_info\x18\x0e \x01(\x0b\x32\x17.google.protobuf.Struct\x12V\n\x19sentiment_analysis_result\x18\x11 \x01(\x0b\x32\x33.google.cloud.dialogflow.v2.SentimentAnalysisResult"\x9c\x03\n\x1cStreamingDetectIntentRequest\x12:\n\x07session\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!dialogflow.googleapis.com/Session\x12\x41\n\x0cquery_params\x18\x02 \x01(\x0b\x32+.google.cloud.dialogflow.v2.QueryParameters\x12@\n\x0bquery_input\x18\x03 \x01(\x0b\x32&.google.cloud.dialogflow.v2.QueryInputB\x03\xe0\x41\x02\x12\x1c\n\x10single_utterance\x18\x04 \x01(\x08\x42\x02\x18\x01\x12J\n\x13output_audio_config\x18\x05 \x01(\x0b\x32-.google.cloud.dialogflow.v2.OutputAudioConfig\x12<\n\x18output_audio_config_mask\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x13\n\x0binput_audio\x18\x06 \x01(\x0c"\xd5\x02\n\x1dStreamingDetectIntentResponse\x12\x13\n\x0bresponse_id\x18\x01 \x01(\t\x12R\n\x12recognition_result\x18\x02 \x01(\x0b\x32\x36.google.cloud.dialogflow.v2.StreamingRecognitionResult\x12=\n\x0cquery_result\x18\x03 \x01(\x0b\x32\'.google.cloud.dialogflow.v2.QueryResult\x12*\n\x0ewebhook_status\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\x12\x14\n\x0coutput_audio\x18\x05 \x01(\x0c\x12J\n\x13output_audio_config\x18\x06 \x01(\x0b\x32-.google.cloud.dialogflow.v2.OutputAudioConfig"\x86\x03\n\x1aStreamingRecognitionResult\x12X\n\x0cmessage_type\x18\x01 \x01(\x0e\x32\x42.google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType\x12\x12\n\ntranscript\x18\x02 \x01(\t\x12\x10\n\x08is_final\x18\x03 \x01(\x08\x12\x12\n\nconfidence\x18\x04 \x01(\x02\x12\x44\n\x10speech_word_info\x18\x07 \x03(\x0b\x32*.google.cloud.dialogflow.v2.SpeechWordInfo\x12\x34\n\x11speech_end_offset\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration"X\n\x0bMessageType\x12\x1c\n\x18MESSAGE_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nTRANSCRIPT\x10\x01\x12\x1b\n\x17\x45ND_OF_SINGLE_UTTERANCE\x10\x02":\n\tTextInput\x12\x11\n\x04text\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x02"h\n\nEventInput\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12+\n\nparameters\x18\x02 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x02"F\n\x1eSentimentAnalysisRequestConfig\x12$\n\x1c\x61nalyze_query_text_sentiment\x18\x01 \x01(\x08"^\n\x17SentimentAnalysisResult\x12\x43\n\x14query_text_sentiment\x18\x01 \x01(\x0b\x32%.google.cloud.dialogflow.v2.Sentiment"-\n\tSentiment\x12\r\n\x05score\x18\x01 \x01(\x02\x12\x11\n\tmagnitude\x18\x02 \x01(\x02\x32\xbc\x04\n\x08Sessions\x12\xa0\x02\n\x0c\x44\x65tectIntent\x12/.google.cloud.dialogflow.v2.DetectIntentRequest\x1a\x30.google.cloud.dialogflow.v2.DetectIntentResponse"\xac\x01\x82\xd3\xe4\x93\x02\x8f\x01"6/v2/{session=projects/*/agent/sessions/*}:detectIntent:\x01*ZR"M/v2/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent:\x01*\xda\x41\x13session,query_input\x12\x92\x01\n\x15StreamingDetectIntent\x12\x38.google.cloud.dialogflow.v2.StreamingDetectIntentRequest\x1a\x39.google.cloud.dialogflow.v2.StreamingDetectIntentResponse"\x00(\x01\x30\x01\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\xc4\x02\n\x1e\x63om.google.cloud.dialogflow.v2B\x0cSessionProtoP\x01ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1aGoogle.Cloud.Dialogflow.V2\xea\x41\xa5\x01\n!dialogflow.googleapis.com/Session\x12+projects/{project}/agent/sessions/{session}\x12Sprojects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_audio__config__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.DESCRIPTOR, - google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, - google_dot_rpc_dot_status__pb2.DESCRIPTOR, - google_dot_type_dot_latlng__pb2.DESCRIPTOR, - ], -) - - -_STREAMINGRECOGNITIONRESULT_MESSAGETYPE = _descriptor.EnumDescriptor( - name="MessageType", - full_name="google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="MESSAGE_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TRANSCRIPT", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="END_OF_SINGLE_UTTERANCE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=3485, - serialized_end=3573, -) -_sym_db.RegisterEnumDescriptor(_STREAMINGRECOGNITIONRESULT_MESSAGETYPE) - - -_DETECTINTENTREQUEST = _descriptor.Descriptor( - name="DetectIntentRequest", - full_name="google.cloud.dialogflow.v2.DetectIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="session", - full_name="google.cloud.dialogflow.v2.DetectIntentRequest.session", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\n!dialogflow.googleapis.com/Session", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_params", - full_name="google.cloud.dialogflow.v2.DetectIntentRequest.query_params", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_input", - full_name="google.cloud.dialogflow.v2.DetectIntentRequest.query_input", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config", - full_name="google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config_mask", - full_name="google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config_mask", - index=4, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="input_audio", - full_name="google.cloud.dialogflow.v2.DetectIntentRequest.input_audio", - index=5, - number=5, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=549, - serialized_end=922, -) - - -_DETECTINTENTRESPONSE = _descriptor.Descriptor( - name="DetectIntentResponse", - full_name="google.cloud.dialogflow.v2.DetectIntentResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="response_id", - full_name="google.cloud.dialogflow.v2.DetectIntentResponse.response_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_result", - full_name="google.cloud.dialogflow.v2.DetectIntentResponse.query_result", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_status", - full_name="google.cloud.dialogflow.v2.DetectIntentResponse.webhook_status", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio", - full_name="google.cloud.dialogflow.v2.DetectIntentResponse.output_audio", - index=3, - number=4, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config", - full_name="google.cloud.dialogflow.v2.DetectIntentResponse.output_audio_config", - index=4, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=925, - serialized_end=1173, -) - - -_QUERYPARAMETERS = _descriptor.Descriptor( - name="QueryParameters", - full_name="google.cloud.dialogflow.v2.QueryParameters", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="time_zone", - full_name="google.cloud.dialogflow.v2.QueryParameters.time_zone", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="geo_location", - full_name="google.cloud.dialogflow.v2.QueryParameters.geo_location", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="contexts", - full_name="google.cloud.dialogflow.v2.QueryParameters.contexts", - index=2, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="reset_contexts", - full_name="google.cloud.dialogflow.v2.QueryParameters.reset_contexts", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="session_entity_types", - full_name="google.cloud.dialogflow.v2.QueryParameters.session_entity_types", - index=4, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="payload", - full_name="google.cloud.dialogflow.v2.QueryParameters.payload", - index=5, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sentiment_analysis_request_config", - full_name="google.cloud.dialogflow.v2.QueryParameters.sentiment_analysis_request_config", - index=6, - number=10, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1176, - serialized_end=1556, -) - - -_QUERYINPUT = _descriptor.Descriptor( - name="QueryInput", - full_name="google.cloud.dialogflow.v2.QueryInput", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="audio_config", - full_name="google.cloud.dialogflow.v2.QueryInput.audio_config", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2.QueryInput.text", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="event", - full_name="google.cloud.dialogflow.v2.QueryInput.event", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="input", - full_name="google.cloud.dialogflow.v2.QueryInput.input", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=1559, - serialized_end=1762, -) - - -_QUERYRESULT = _descriptor.Descriptor( - name="QueryResult", - full_name="google.cloud.dialogflow.v2.QueryResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="query_text", - full_name="google.cloud.dialogflow.v2.QueryResult.query_text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.QueryResult.language_code", - index=1, - number=15, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="speech_recognition_confidence", - full_name="google.cloud.dialogflow.v2.QueryResult.speech_recognition_confidence", - index=2, - number=2, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="action", - full_name="google.cloud.dialogflow.v2.QueryResult.action", - index=3, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parameters", - full_name="google.cloud.dialogflow.v2.QueryResult.parameters", - index=4, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="all_required_params_present", - full_name="google.cloud.dialogflow.v2.QueryResult.all_required_params_present", - index=5, - number=5, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="fulfillment_text", - full_name="google.cloud.dialogflow.v2.QueryResult.fulfillment_text", - index=6, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="fulfillment_messages", - full_name="google.cloud.dialogflow.v2.QueryResult.fulfillment_messages", - index=7, - number=7, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_source", - full_name="google.cloud.dialogflow.v2.QueryResult.webhook_source", - index=8, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_payload", - full_name="google.cloud.dialogflow.v2.QueryResult.webhook_payload", - index=9, - number=9, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_contexts", - full_name="google.cloud.dialogflow.v2.QueryResult.output_contexts", - index=10, - number=10, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent", - full_name="google.cloud.dialogflow.v2.QueryResult.intent", - index=11, - number=11, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_detection_confidence", - full_name="google.cloud.dialogflow.v2.QueryResult.intent_detection_confidence", - index=12, - number=12, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="diagnostic_info", - full_name="google.cloud.dialogflow.v2.QueryResult.diagnostic_info", - index=13, - number=14, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sentiment_analysis_result", - full_name="google.cloud.dialogflow.v2.QueryResult.sentiment_analysis_result", - index=14, - number=17, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1765, - serialized_end=2421, -) - - -_STREAMINGDETECTINTENTREQUEST = _descriptor.Descriptor( - name="StreamingDetectIntentRequest", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="session", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\n!dialogflow.googleapis.com/Session", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_params", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_input", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="single_utterance", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentRequest.single_utterance", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\030\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config_mask", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config_mask", - index=5, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="input_audio", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio", - index=6, - number=6, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2424, - serialized_end=2836, -) - - -_STREAMINGDETECTINTENTRESPONSE = _descriptor.Descriptor( - name="StreamingDetectIntentResponse", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="response_id", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentResponse.response_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="recognition_result", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentResponse.recognition_result", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_result", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentResponse.query_result", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_status", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentResponse.webhook_status", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentResponse.output_audio", - index=4, - number=5, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config", - full_name="google.cloud.dialogflow.v2.StreamingDetectIntentResponse.output_audio_config", - index=5, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2839, - serialized_end=3180, -) - - -_STREAMINGRECOGNITIONRESULT = _descriptor.Descriptor( - name="StreamingRecognitionResult", - full_name="google.cloud.dialogflow.v2.StreamingRecognitionResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="message_type", - full_name="google.cloud.dialogflow.v2.StreamingRecognitionResult.message_type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="transcript", - full_name="google.cloud.dialogflow.v2.StreamingRecognitionResult.transcript", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_final", - full_name="google.cloud.dialogflow.v2.StreamingRecognitionResult.is_final", - index=2, - number=3, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="confidence", - full_name="google.cloud.dialogflow.v2.StreamingRecognitionResult.confidence", - index=3, - number=4, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="speech_word_info", - full_name="google.cloud.dialogflow.v2.StreamingRecognitionResult.speech_word_info", - index=4, - number=7, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="speech_end_offset", - full_name="google.cloud.dialogflow.v2.StreamingRecognitionResult.speech_end_offset", - index=5, - number=8, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_STREAMINGRECOGNITIONRESULT_MESSAGETYPE], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3183, - serialized_end=3573, -) - - -_TEXTINPUT = _descriptor.Descriptor( - name="TextInput", - full_name="google.cloud.dialogflow.v2.TextInput", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2.TextInput.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.TextInput.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3575, - serialized_end=3633, -) - - -_EVENTINPUT = _descriptor.Descriptor( - name="EventInput", - full_name="google.cloud.dialogflow.v2.EventInput", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2.EventInput.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parameters", - full_name="google.cloud.dialogflow.v2.EventInput.parameters", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2.EventInput.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3635, - serialized_end=3739, -) - - -_SENTIMENTANALYSISREQUESTCONFIG = _descriptor.Descriptor( - name="SentimentAnalysisRequestConfig", - full_name="google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="analyze_query_text_sentiment", - full_name="google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig.analyze_query_text_sentiment", - index=0, - number=1, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3741, - serialized_end=3811, -) - - -_SENTIMENTANALYSISRESULT = _descriptor.Descriptor( - name="SentimentAnalysisResult", - full_name="google.cloud.dialogflow.v2.SentimentAnalysisResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="query_text_sentiment", - full_name="google.cloud.dialogflow.v2.SentimentAnalysisResult.query_text_sentiment", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3813, - serialized_end=3907, -) - - -_SENTIMENT = _descriptor.Descriptor( - name="Sentiment", - full_name="google.cloud.dialogflow.v2.Sentiment", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="score", - full_name="google.cloud.dialogflow.v2.Sentiment.score", - index=0, - number=1, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="magnitude", - full_name="google.cloud.dialogflow.v2.Sentiment.magnitude", - index=1, - number=2, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3909, - serialized_end=3954, -) - -_DETECTINTENTREQUEST.fields_by_name["query_params"].message_type = _QUERYPARAMETERS -_DETECTINTENTREQUEST.fields_by_name["query_input"].message_type = _QUERYINPUT -_DETECTINTENTREQUEST.fields_by_name[ - "output_audio_config" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_audio__config__pb2._OUTPUTAUDIOCONFIG -) -_DETECTINTENTREQUEST.fields_by_name[ - "output_audio_config_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_DETECTINTENTRESPONSE.fields_by_name["query_result"].message_type = _QUERYRESULT -_DETECTINTENTRESPONSE.fields_by_name[ - "webhook_status" -].message_type = google_dot_rpc_dot_status__pb2._STATUS -_DETECTINTENTRESPONSE.fields_by_name[ - "output_audio_config" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_audio__config__pb2._OUTPUTAUDIOCONFIG -) -_QUERYPARAMETERS.fields_by_name[ - "geo_location" -].message_type = google_dot_type_dot_latlng__pb2._LATLNG -_QUERYPARAMETERS.fields_by_name[ - "contexts" -].message_type = google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2._CONTEXT -_QUERYPARAMETERS.fields_by_name[ - "session_entity_types" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2._SESSIONENTITYTYPE -) -_QUERYPARAMETERS.fields_by_name[ - "payload" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_QUERYPARAMETERS.fields_by_name[ - "sentiment_analysis_request_config" -].message_type = _SENTIMENTANALYSISREQUESTCONFIG -_QUERYINPUT.fields_by_name[ - "audio_config" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_audio__config__pb2._INPUTAUDIOCONFIG -) -_QUERYINPUT.fields_by_name["text"].message_type = _TEXTINPUT -_QUERYINPUT.fields_by_name["event"].message_type = _EVENTINPUT -_QUERYINPUT.oneofs_by_name["input"].fields.append( - _QUERYINPUT.fields_by_name["audio_config"] -) -_QUERYINPUT.fields_by_name[ - "audio_config" -].containing_oneof = _QUERYINPUT.oneofs_by_name["input"] -_QUERYINPUT.oneofs_by_name["input"].fields.append(_QUERYINPUT.fields_by_name["text"]) -_QUERYINPUT.fields_by_name["text"].containing_oneof = _QUERYINPUT.oneofs_by_name[ - "input" -] -_QUERYINPUT.oneofs_by_name["input"].fields.append(_QUERYINPUT.fields_by_name["event"]) -_QUERYINPUT.fields_by_name["event"].containing_oneof = _QUERYINPUT.oneofs_by_name[ - "input" -] -_QUERYRESULT.fields_by_name[ - "parameters" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_QUERYRESULT.fields_by_name[ - "fulfillment_messages" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2._INTENT_MESSAGE -) -_QUERYRESULT.fields_by_name[ - "webhook_payload" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_QUERYRESULT.fields_by_name[ - "output_contexts" -].message_type = google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2._CONTEXT -_QUERYRESULT.fields_by_name[ - "intent" -].message_type = google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2._INTENT -_QUERYRESULT.fields_by_name[ - "diagnostic_info" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_QUERYRESULT.fields_by_name[ - "sentiment_analysis_result" -].message_type = _SENTIMENTANALYSISRESULT -_STREAMINGDETECTINTENTREQUEST.fields_by_name[ - "query_params" -].message_type = _QUERYPARAMETERS -_STREAMINGDETECTINTENTREQUEST.fields_by_name["query_input"].message_type = _QUERYINPUT -_STREAMINGDETECTINTENTREQUEST.fields_by_name[ - "output_audio_config" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_audio__config__pb2._OUTPUTAUDIOCONFIG -) -_STREAMINGDETECTINTENTREQUEST.fields_by_name[ - "output_audio_config_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_STREAMINGDETECTINTENTRESPONSE.fields_by_name[ - "recognition_result" -].message_type = _STREAMINGRECOGNITIONRESULT -_STREAMINGDETECTINTENTRESPONSE.fields_by_name[ - "query_result" -].message_type = _QUERYRESULT -_STREAMINGDETECTINTENTRESPONSE.fields_by_name[ - "webhook_status" -].message_type = google_dot_rpc_dot_status__pb2._STATUS -_STREAMINGDETECTINTENTRESPONSE.fields_by_name[ - "output_audio_config" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_audio__config__pb2._OUTPUTAUDIOCONFIG -) -_STREAMINGRECOGNITIONRESULT.fields_by_name[ - "message_type" -].enum_type = _STREAMINGRECOGNITIONRESULT_MESSAGETYPE -_STREAMINGRECOGNITIONRESULT.fields_by_name[ - "speech_word_info" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_audio__config__pb2._SPEECHWORDINFO -) -_STREAMINGRECOGNITIONRESULT.fields_by_name[ - "speech_end_offset" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_STREAMINGRECOGNITIONRESULT_MESSAGETYPE.containing_type = _STREAMINGRECOGNITIONRESULT -_EVENTINPUT.fields_by_name[ - "parameters" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_SENTIMENTANALYSISRESULT.fields_by_name[ - "query_text_sentiment" -].message_type = _SENTIMENT -DESCRIPTOR.message_types_by_name["DetectIntentRequest"] = _DETECTINTENTREQUEST -DESCRIPTOR.message_types_by_name["DetectIntentResponse"] = _DETECTINTENTRESPONSE -DESCRIPTOR.message_types_by_name["QueryParameters"] = _QUERYPARAMETERS -DESCRIPTOR.message_types_by_name["QueryInput"] = _QUERYINPUT -DESCRIPTOR.message_types_by_name["QueryResult"] = _QUERYRESULT -DESCRIPTOR.message_types_by_name[ - "StreamingDetectIntentRequest" -] = _STREAMINGDETECTINTENTREQUEST -DESCRIPTOR.message_types_by_name[ - "StreamingDetectIntentResponse" -] = _STREAMINGDETECTINTENTRESPONSE -DESCRIPTOR.message_types_by_name[ - "StreamingRecognitionResult" -] = _STREAMINGRECOGNITIONRESULT -DESCRIPTOR.message_types_by_name["TextInput"] = _TEXTINPUT -DESCRIPTOR.message_types_by_name["EventInput"] = _EVENTINPUT -DESCRIPTOR.message_types_by_name[ - "SentimentAnalysisRequestConfig" -] = _SENTIMENTANALYSISREQUESTCONFIG -DESCRIPTOR.message_types_by_name["SentimentAnalysisResult"] = _SENTIMENTANALYSISRESULT -DESCRIPTOR.message_types_by_name["Sentiment"] = _SENTIMENT -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -DetectIntentRequest = _reflection.GeneratedProtocolMessageType( - "DetectIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _DETECTINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """The request to detect user’s intent. - - Attributes: - session: - Required. The name of the session this query is sent to. - Format: ``projects//agent/sessions/``, - or ``projects//agent/environments//users//sessions/``. If ``Environment - ID`` is not specified, we assume default ‘draft’ environment. - If ``User ID`` is not specified, we are using “-”. It’s up to - the API caller to choose an appropriate ``Session ID`` and - ``User Id``. They can be a random number or some type of user - and session identifiers (preferably hashed). The length of the - ``Session ID`` and ``User ID`` must not exceed 36 characters. - For more information, see the `API interactions guide - `__. - query_params: - The parameters of this query. - query_input: - Required. The input specification. It can be set to: 1. an - audio config which instructs the speech recognizer how to - process the speech audio, 2. a conversational query in the - form of text, or 3. an event that specifies which intent to - trigger. - output_audio_config: - Instructs the speech synthesizer how to generate the output - audio. If this field is not set and agent-level speech - synthesizer is not configured, no output audio is generated. - output_audio_config_mask: - Mask for [output_audio_config][google.cloud.dialogflow.v2.Dete - ctIntentRequest.output_audio_config] indicating which settings - in this request-level config should override speech - synthesizer settings defined at agent-level. If unspecified - or empty, [output_audio_config][google.cloud.dialogflow.v2.Det - ectIntentRequest.output_audio_config] replaces the agent-level - config in its entirety. - input_audio: - The natural language speech audio to be processed. This field - should be populated iff ``query_input`` is set to an input - audio config. A single request can contain up to 1 minute of - speech audio data. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.DetectIntentRequest) - }, -) -_sym_db.RegisterMessage(DetectIntentRequest) - -DetectIntentResponse = _reflection.GeneratedProtocolMessageType( - "DetectIntentResponse", - (_message.Message,), - { - "DESCRIPTOR": _DETECTINTENTRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """The message returned from the DetectIntent method. - - Attributes: - response_id: - The unique identifier of the response. It can be used to - locate a response in the training example set or for reporting - issues. - query_result: - The selected results of the conversational query or event - processing. See ``alternative_query_results`` for additional - potential results. - webhook_status: - Specifies the status of the webhook request. - output_audio: - The audio data bytes encoded as specified in the request. - Note: The output audio is generated based on the values of - default platform text responses found in the - ``query_result.fulfillment_messages`` field. If multiple - default text responses exist, they will be concatenated when - generating audio. If no default platform text responses exist, - the generated audio content will be empty. In some scenarios, - multiple output audio fields may be present in the response - structure. In these cases, only the top-most-level audio - output has content. - output_audio_config: - The config used by the speech synthesizer to generate the - output audio. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.DetectIntentResponse) - }, -) -_sym_db.RegisterMessage(DetectIntentResponse) - -QueryParameters = _reflection.GeneratedProtocolMessageType( - "QueryParameters", - (_message.Message,), - { - "DESCRIPTOR": _QUERYPARAMETERS, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """Represents the parameters of the conversational query. - - Attributes: - time_zone: - The time zone of this conversational query from the `time zone - database `__, e.g., - America/New_York, Europe/Paris. If not provided, the time zone - specified in agent settings is used. - geo_location: - The geo location of this conversational query. - contexts: - The collection of contexts to be activated before this query - is executed. - reset_contexts: - Specifies whether to delete all contexts in the current - session before the new ones are activated. - session_entity_types: - Additional session entity types to replace or extend developer - entity types with. The entity synonyms apply to all languages - and persist for the session of this query. - payload: - This field can be used to pass custom data to your webhook. - Arbitrary JSON objects are supported. If supplied, the value - is used to populate the - ``WebhookRequest.original_detect_intent_request.payload`` - field sent to your webhook. - sentiment_analysis_request_config: - Configures the type of sentiment analysis to perform. If not - provided, sentiment analysis is not performed. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.QueryParameters) - }, -) -_sym_db.RegisterMessage(QueryParameters) - -QueryInput = _reflection.GeneratedProtocolMessageType( - "QueryInput", - (_message.Message,), - { - "DESCRIPTOR": _QUERYINPUT, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """Represents the query input. It can contain either: 1. An audio config - which instructs the speech recognizer how to process the speech - audio. 2. A conversational query in the form of text,. 3. An event - that specifies which intent to trigger. - - Attributes: - input: - Required. The input specification. - audio_config: - Instructs the speech recognizer how to process the speech - audio. - text: - The natural language text to be processed. - event: - The event to be processed. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.QueryInput) - }, -) -_sym_db.RegisterMessage(QueryInput) - -QueryResult = _reflection.GeneratedProtocolMessageType( - "QueryResult", - (_message.Message,), - { - "DESCRIPTOR": _QUERYRESULT, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """Represents the result of conversational query or event processing. - - Attributes: - query_text: - The original conversational query text: - If natural - language text was provided as input, ``query_text`` - contains a copy of the input. - If natural language speech - audio was provided as input, ``query_text`` contains the - speech recognition result. If speech recognizer produced - multiple alternatives, a particular one is picked. - If - automatic spell correction is enabled, ``query_text`` will - contain the corrected user input. - language_code: - The language that was triggered during intent detection. See - `Language Support `__ for a list of the currently supported - language codes. - speech_recognition_confidence: - The Speech recognition confidence between 0.0 and 1.0. A - higher number indicates an estimated greater likelihood that - the recognized words are correct. The default of 0.0 is a - sentinel value indicating that confidence was not set. This - field is not guaranteed to be accurate or set. In particular - this field isn’t set for StreamingDetectIntent since the - streaming endpoint has separate confidence estimates per - portion of the audio in StreamingRecognitionResult. - action: - The action name from the matched intent. - parameters: - The collection of extracted parameters. 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: string or number, depending - on parameter value type - MapValue value: - If - parameter’s entity type is a composite entity: map from - composite entity property names to property values - Else: - parameter value - all_required_params_present: - This field is set to: - ``false`` if the matched intent has - required parameters and not all of the required parameter - values have been collected. - ``true`` if all required - parameter values have been collected, or if the matched - intent doesn’t contain any required parameters. - fulfillment_text: - The text to be pronounced to the user or shown on the screen. - Note: This is a legacy field, ``fulfillment_messages`` should - be preferred. - fulfillment_messages: - The collection of rich messages to present to the user. - webhook_source: - If the query was fulfilled by a webhook call, this field is - set to the value of the ``source`` field returned in the - webhook response. - webhook_payload: - If the query was fulfilled by a webhook call, this field is - set to the value of the ``payload`` field returned in the - webhook response. - output_contexts: - The collection of output contexts. If applicable, - ``output_contexts.parameters`` contains entries with name - ``.original`` containing the original - parameter values before the query. - intent: - The intent that matched the conversational query. Some, not - all fields are filled in this message, including but not - limited to: ``name``, ``display_name``, ``end_interaction`` - and ``is_fallback``. - intent_detection_confidence: - The intent detection confidence. Values range from 0.0 - (completely uncertain) to 1.0 (completely certain). This value - is for informational purpose only and is only used to help - match the best intent within the classification threshold. - This value may change for the same end-user expression at any - time due to a model retraining or change in implementation. If - there are ``multiple knowledge_answers`` messages, this value - is set to the greatest ``knowledgeAnswers.match_confidence`` - value in the list. - diagnostic_info: - Free-form diagnostic information for the associated detect - intent request. The fields of this data can change without - notice, so you should not write code that depends on its - structure. The data may contain: - webhook call latency - - webhook errors - sentiment_analysis_result: - The sentiment analysis result, which depends on the - ``sentiment_analysis_request_config`` specified in the - request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.QueryResult) - }, -) -_sym_db.RegisterMessage(QueryResult) - -StreamingDetectIntentRequest = _reflection.GeneratedProtocolMessageType( - "StreamingDetectIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _STREAMINGDETECTINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """The top-level message sent by the client to the [Sessions.StreamingDet - ectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent] - method. Multiple request messages should be sent in order: 1. The - first message must contain [session][google.cloud.dialogflow.v2.Str - eamingDetectIntentRequest.session], [query_input][google.cloud.dial - ogflow.v2.StreamingDetectIntentRequest.query_input] plus optionally - [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest - .query_params]. If the client wants to receive an audio response, - it should also contain [output_audio_config][google.cloud.dialog - flow.v2.StreamingDetectIntentRequest.output_audio_config]. The - message must not contain [input_audio][google.cloud.dialogflow.v2.S - treamingDetectIntentRequest.input_audio]. 2. If [query_input][googl - e.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] was - set to [query_input.audio_config][google.cloud.dialogflow.v2.InputA - udioConfig], all subsequent messages must contain [input_audio][ - google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio] - to continue with Speech recognition. If you decide to rather detect - an intent from text input after you already started Speech - recognition, please send a message with - [query_input.text][google.cloud.dialogflow.v2.QueryInput.text]. - However, note that: - Dialogflow will bill you for the audio - duration so far. - Dialogflow discards all Speech recognition - results in favor of the input text. - Dialogflow will use - the language code from the first message. After you sent all input, - you must half-close or abort the request stream. - - Attributes: - session: - Required. The name of the session the query is sent to. Format - of the session name: ``projects//agent/sessions/``, or ``projects//agent/environments//users//sessions/``. If ``Environment ID`` is not - specified, we assume default ‘draft’ environment. If ``User - ID`` is not specified, we are using “-”. It’s up to the API - caller to choose an appropriate ``Session ID`` and ``User - Id``. They can be a random number or some type of user and - session identifiers (preferably hashed). The length of the - ``Session ID`` and ``User ID`` must not exceed 36 characters. - For more information, see the `API interactions guide - `__. - query_params: - The parameters of this query. - query_input: - Required. The input specification. It can be set to: 1. an - audio config which instructs the speech recognizer how to - process the speech audio, 2. a conversational query in the - form of text, or 3. an event that specifies which intent to - trigger. - single_utterance: - Please use [InputAudioConfig.single_utterance][google.cloud.di - alogflow.v2.InputAudioConfig.single_utterance] instead. If - ``false`` (default), recognition does not cease until the - client closes the stream. If ``true``, the recognizer will - detect a single spoken utterance in input audio. Recognition - ceases when it detects the audio’s voice has stopped or - paused. In this case, once a detected intent is received, the - client should close the stream and start a new request with a - new stream as needed. This setting is ignored when - ``query_input`` is a piece of text or an event. - output_audio_config: - Instructs the speech synthesizer how to generate the output - audio. If this field is not set and agent-level speech - synthesizer is not configured, no output audio is generated. - output_audio_config_mask: - Mask for [output_audio_config][google.cloud.dialogflow.v2.Stre - amingDetectIntentRequest.output_audio_config] indicating which - settings in this request-level config should override speech - synthesizer settings defined at agent-level. If unspecified - or empty, [output_audio_config][google.cloud.dialogflow.v2.Str - eamingDetectIntentRequest.output_audio_config] replaces the - agent-level config in its entirety. - input_audio: - The input audio content to be recognized. Must be sent if - ``query_input`` was set to a streaming input audio config. The - complete audio over all streaming messages must not exceed 1 - minute. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.StreamingDetectIntentRequest) - }, -) -_sym_db.RegisterMessage(StreamingDetectIntentRequest) - -StreamingDetectIntentResponse = _reflection.GeneratedProtocolMessageType( - "StreamingDetectIntentResponse", - (_message.Message,), - { - "DESCRIPTOR": _STREAMINGDETECTINTENTRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """The top-level message returned from the ``StreamingDetectIntent`` - method. Multiple response messages can be returned in order: 1. If - the input was set to streaming audio, the first one or more - messages contain ``recognition_result``. Each ``recognition_result`` - represents a more complete transcript of what the user said. The last - ``recognition_result`` has ``is_final`` set to ``true``. 2. The next - message contains ``response_id``, ``query_result`` and optionally - ``webhook_status`` if a WebHook was called. - - Attributes: - response_id: - The unique identifier of the response. It can be used to - locate a response in the training example set or for reporting - issues. - recognition_result: - The result of speech recognition. - query_result: - The result of the conversational query or event processing. - webhook_status: - Specifies the status of the webhook request. - output_audio: - The audio data bytes encoded as specified in the request. - Note: The output audio is generated based on the values of - default platform text responses found in the - ``query_result.fulfillment_messages`` field. If multiple - default text responses exist, they will be concatenated when - generating audio. If no default platform text responses exist, - the generated audio content will be empty. In some scenarios, - multiple output audio fields may be present in the response - structure. In these cases, only the top-most-level audio - output has content. - output_audio_config: - The config used by the speech synthesizer to generate the - output audio. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.StreamingDetectIntentResponse) - }, -) -_sym_db.RegisterMessage(StreamingDetectIntentResponse) - -StreamingRecognitionResult = _reflection.GeneratedProtocolMessageType( - "StreamingRecognitionResult", - (_message.Message,), - { - "DESCRIPTOR": _STREAMINGRECOGNITIONRESULT, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """Contains a speech recognition result corresponding to a portion of the - audio that is currently being processed or an indication that this is - the end of the single requested utterance. Example: 1. transcript: - “tube” 2. transcript: “to be a” 3. transcript: “to be” 4. - transcript: “to be or not to be” is_final: true 5. transcript: " - that’s" 6. transcript: " that is" 7. message_type: - ``END_OF_SINGLE_UTTERANCE`` 8. transcript: " that is the question" - is_final: true Only two of the responses contain final results (#4 - and #8 indicated by ``is_final: true``). Concatenating these generates - the full transcript: “to be or not to be that is the question”. In - each response we populate: - for ``TRANSCRIPT``: ``transcript`` and - possibly ``is_final``. - for ``END_OF_SINGLE_UTTERANCE``: only - ``message_type``. - - Attributes: - message_type: - Type of the result message. - transcript: - Transcript text representing the words that the user spoke. - Populated if and only if ``message_type`` = ``TRANSCRIPT``. - is_final: - If ``false``, the ``StreamingRecognitionResult`` represents an - interim result that may change. If ``true``, the recognizer - will not return any further hypotheses about this piece of the - audio. May only be populated for ``message_type`` = - ``TRANSCRIPT``. - confidence: - The Speech confidence between 0.0 and 1.0 for the current - portion of audio. A higher number indicates an estimated - greater likelihood that the recognized words are correct. The - default of 0.0 is a sentinel value indicating that confidence - was not set. This field is typically only provided if - ``is_final`` is true and you should not rely on it being - accurate or even set. - speech_word_info: - Word-specific information for the words recognized by Speech - in [transcript][google.cloud.dialogflow.v2.StreamingRecognitio - nResult.transcript]. Populated if and only if ``message_type`` - = ``TRANSCRIPT`` and [InputAudioConfig.enable_word_info] is - set. - speech_end_offset: - Time offset of the end of this Speech recognition result - relative to the beginning of the audio. Only populated for - ``message_type`` = ``TRANSCRIPT``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.StreamingRecognitionResult) - }, -) -_sym_db.RegisterMessage(StreamingRecognitionResult) - -TextInput = _reflection.GeneratedProtocolMessageType( - "TextInput", - (_message.Message,), - { - "DESCRIPTOR": _TEXTINPUT, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """Represents the natural language text to be processed. - - Attributes: - text: - Required. The UTF-8 encoded natural language text to be - processed. Text length must not exceed 256 characters. - language_code: - Required. The language of this conversational query. See - `Language Support `__ for a list of the currently supported - language codes. Note that queries in the same session do not - necessarily need to specify the same language. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.TextInput) - }, -) -_sym_db.RegisterMessage(TextInput) - -EventInput = _reflection.GeneratedProtocolMessageType( - "EventInput", - (_message.Message,), - { - "DESCRIPTOR": _EVENTINPUT, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """Events allow for matching intents by event name instead of the natural - language input. For instance, input ```` can trigger a personalized welcome - response. The parameter ``name`` may be used by the agent in the - response: ``"Hello #welcome_event.name! What can I do for you - today?"``. - - Attributes: - name: - Required. The unique identifier of the event. - parameters: - The collection of parameters associated with the event. - 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: string or number, depending - on parameter value type - MapValue value: - If - parameter’s entity type is a composite entity: map from - composite entity property names to property values - Else: - parameter value - language_code: - Required. The language of this query. See `Language Support `__ - for a list of the currently supported language codes. Note - that queries in the same session do not necessarily need to - specify the same language. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.EventInput) - }, -) -_sym_db.RegisterMessage(EventInput) - -SentimentAnalysisRequestConfig = _reflection.GeneratedProtocolMessageType( - "SentimentAnalysisRequestConfig", - (_message.Message,), - { - "DESCRIPTOR": _SENTIMENTANALYSISREQUESTCONFIG, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """Configures the types of sentiment analysis to perform. - - Attributes: - analyze_query_text_sentiment: - Instructs the service to perform sentiment analysis on - ``query_text``. If not provided, sentiment analysis is not - performed on ``query_text``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig) - }, -) -_sym_db.RegisterMessage(SentimentAnalysisRequestConfig) - -SentimentAnalysisResult = _reflection.GeneratedProtocolMessageType( - "SentimentAnalysisResult", - (_message.Message,), - { - "DESCRIPTOR": _SENTIMENTANALYSISRESULT, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """The result of sentiment analysis. Sentiment analysis inspects user - input and identifies the prevailing subjective opinion, especially to - determine a user’s attitude as positive, negative, or neutral. For [Pa - rticipants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.Ana - lyzeContent], it needs to be configured in [DetectIntentRequest.query_ - params][google.cloud.dialogflow.v2.DetectIntentRequest.query_params]. - For [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2. - Participants.StreamingAnalyzeContent], it needs to be configured in [S - treamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2.S - treamingDetectIntentRequest.query_params]. And for [Participants.Analy - zeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and - [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Part - icipants.StreamingAnalyzeContent], it needs to be configured in [Conve - rsationProfile.human_agent_assistant_config][google.cloud.dialogflow.v - 2.ConversationProfile.human_agent_assistant_config] - - Attributes: - query_text_sentiment: - The sentiment analysis result for ``query_text``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.SentimentAnalysisResult) - }, -) -_sym_db.RegisterMessage(SentimentAnalysisResult) - -Sentiment = _reflection.GeneratedProtocolMessageType( - "Sentiment", - (_message.Message,), - { - "DESCRIPTOR": _SENTIMENT, - "__module__": "google.cloud.dialogflow_v2.proto.session_pb2", - "__doc__": """The sentiment, such as positive/negative feeling or association, for a - unit of analysis, such as the query text. - - Attributes: - score: - Sentiment score between -1.0 (negative sentiment) and 1.0 - (positive sentiment). - magnitude: - A non-negative number in the [0, +inf) range, which represents - the absolute magnitude of sentiment, regardless of score - (positive or negative). - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.Sentiment) - }, -) -_sym_db.RegisterMessage(Sentiment) - - -DESCRIPTOR._options = None -_DETECTINTENTREQUEST.fields_by_name["session"]._options = None -_DETECTINTENTREQUEST.fields_by_name["query_input"]._options = None -_STREAMINGDETECTINTENTREQUEST.fields_by_name["session"]._options = None -_STREAMINGDETECTINTENTREQUEST.fields_by_name["query_input"]._options = None -_STREAMINGDETECTINTENTREQUEST.fields_by_name["single_utterance"]._options = None -_TEXTINPUT.fields_by_name["text"]._options = None -_TEXTINPUT.fields_by_name["language_code"]._options = None -_EVENTINPUT.fields_by_name["name"]._options = None -_EVENTINPUT.fields_by_name["language_code"]._options = None - -_SESSIONS = _descriptor.ServiceDescriptor( - name="Sessions", - full_name="google.cloud.dialogflow.v2.Sessions", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=3957, - serialized_end=4529, - methods=[ - _descriptor.MethodDescriptor( - name="DetectIntent", - full_name="google.cloud.dialogflow.v2.Sessions.DetectIntent", - index=0, - containing_service=None, - input_type=_DETECTINTENTREQUEST, - output_type=_DETECTINTENTRESPONSE, - serialized_options=b'\202\323\344\223\002\217\001"6/v2/{session=projects/*/agent/sessions/*}:detectIntent:\001*ZR"M/v2/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent:\001*\332A\023session,query_input', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="StreamingDetectIntent", - full_name="google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent", - index=1, - containing_service=None, - input_type=_STREAMINGDETECTINTENTREQUEST, - output_type=_STREAMINGDETECTINTENTRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_SESSIONS) - -DESCRIPTOR.services_by_name["Sessions"] = _SESSIONS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2/proto/session_pb2_grpc.py b/dialogflow_v2/proto/session_pb2_grpc.py deleted file mode 100644 index d83706aff..000000000 --- a/dialogflow_v2/proto/session_pb2_grpc.py +++ /dev/null @@ -1,141 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2.proto import ( - session_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2, -) - - -class SessionsStub(object): - """A service used for session interactions. - - For more information, see the [API interactions - guide](https://cloud.google.com/dialogflow/docs/api-overview). - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.DetectIntent = channel.unary_unary( - "/google.cloud.dialogflow.v2.Sessions/DetectIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.DetectIntentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.DetectIntentResponse.FromString, - ) - self.StreamingDetectIntent = channel.stream_stream( - "/google.cloud.dialogflow.v2.Sessions/StreamingDetectIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.StreamingDetectIntentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.StreamingDetectIntentResponse.FromString, - ) - - -class SessionsServicer(object): - """A service used for session interactions. - - For more information, see the [API interactions - guide](https://cloud.google.com/dialogflow/docs/api-overview). - """ - - def DetectIntent(self, request, context): - """Processes a natural language query and returns structured, actionable data - as a result. This method is not idempotent, because it may cause contexts - and session entity types to be updated, which in turn might affect - results of future queries. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def StreamingDetectIntent(self, request_iterator, context): - """Processes a natural language query in audio format in a streaming fashion - and returns structured, actionable data as a result. This method is only - available via the gRPC API (not REST). - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_SessionsServicer_to_server(servicer, server): - rpc_method_handlers = { - "DetectIntent": grpc.unary_unary_rpc_method_handler( - servicer.DetectIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.DetectIntentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.DetectIntentResponse.SerializeToString, - ), - "StreamingDetectIntent": grpc.stream_stream_rpc_method_handler( - servicer.StreamingDetectIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.StreamingDetectIntentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.StreamingDetectIntentResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2.Sessions", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Sessions(object): - """A service used for session interactions. - - For more information, see the [API interactions - guide](https://cloud.google.com/dialogflow/docs/api-overview). - """ - - @staticmethod - def DetectIntent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2.Sessions/DetectIntent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.DetectIntentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.DetectIntentResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def StreamingDetectIntent( - request_iterator, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.stream_stream( - request_iterator, - target, - "/google.cloud.dialogflow.v2.Sessions/StreamingDetectIntent", - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.StreamingDetectIntentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.StreamingDetectIntentResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2/proto/validation_result_pb2.py b/dialogflow_v2/proto/validation_result_pb2.py deleted file mode 100644 index 1d969487c..000000000 --- a/dialogflow_v2/proto/validation_result_pb2.py +++ /dev/null @@ -1,260 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2/proto/validation_result.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2/proto/validation_result.proto", - package="google.cloud.dialogflow.v2", - syntax="proto3", - serialized_options=b"\n\036com.google.cloud.dialogflow.v2B\025ValidationResultProtoP\001ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cloud.Dialogflow.V2", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n8google/cloud/dialogflow_v2/proto/validation_result.proto\x12\x1agoogle.cloud.dialogflow.v2\x1a\x1cgoogle/api/annotations.proto"\xd7\x01\n\x0fValidationError\x12\x46\n\x08severity\x18\x01 \x01(\x0e\x32\x34.google.cloud.dialogflow.v2.ValidationError.Severity\x12\x0f\n\x07\x65ntries\x18\x03 \x03(\t\x12\x15\n\rerror_message\x18\x04 \x01(\t"T\n\x08Severity\x12\x18\n\x14SEVERITY_UNSPECIFIED\x10\x00\x12\x08\n\x04INFO\x10\x01\x12\x0b\n\x07WARNING\x10\x02\x12\t\n\x05\x45RROR\x10\x03\x12\x0c\n\x08\x43RITICAL\x10\x04"Z\n\x10ValidationResult\x12\x46\n\x11validation_errors\x18\x01 \x03(\x0b\x32+.google.cloud.dialogflow.v2.ValidationErrorB\xa4\x01\n\x1e\x63om.google.cloud.dialogflow.v2B\x15ValidationResultProtoP\x01ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1aGoogle.Cloud.Dialogflow.V2b\x06proto3', - dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR], -) - - -_VALIDATIONERROR_SEVERITY = _descriptor.EnumDescriptor( - name="Severity", - full_name="google.cloud.dialogflow.v2.ValidationError.Severity", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="SEVERITY_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INFO", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WARNING", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ERROR", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CRITICAL", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=250, - serialized_end=334, -) -_sym_db.RegisterEnumDescriptor(_VALIDATIONERROR_SEVERITY) - - -_VALIDATIONERROR = _descriptor.Descriptor( - name="ValidationError", - full_name="google.cloud.dialogflow.v2.ValidationError", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="severity", - full_name="google.cloud.dialogflow.v2.ValidationError.severity", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entries", - full_name="google.cloud.dialogflow.v2.ValidationError.entries", - index=1, - number=3, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="error_message", - full_name="google.cloud.dialogflow.v2.ValidationError.error_message", - index=2, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_VALIDATIONERROR_SEVERITY], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=119, - serialized_end=334, -) - - -_VALIDATIONRESULT = _descriptor.Descriptor( - name="ValidationResult", - full_name="google.cloud.dialogflow.v2.ValidationResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="validation_errors", - full_name="google.cloud.dialogflow.v2.ValidationResult.validation_errors", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=336, - serialized_end=426, -) - -_VALIDATIONERROR.fields_by_name["severity"].enum_type = _VALIDATIONERROR_SEVERITY -_VALIDATIONERROR_SEVERITY.containing_type = _VALIDATIONERROR -_VALIDATIONRESULT.fields_by_name["validation_errors"].message_type = _VALIDATIONERROR -DESCRIPTOR.message_types_by_name["ValidationError"] = _VALIDATIONERROR -DESCRIPTOR.message_types_by_name["ValidationResult"] = _VALIDATIONRESULT -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -ValidationError = _reflection.GeneratedProtocolMessageType( - "ValidationError", - (_message.Message,), - { - "DESCRIPTOR": _VALIDATIONERROR, - "__module__": "google.cloud.dialogflow_v2.proto.validation_result_pb2", - "__doc__": """Represents a single validation error. - - Attributes: - severity: - The severity of the error. - entries: - The names of the entries that the error is associated with. - Format: - “projects//agent”, if the error is associated with - the entire agent. - “projects//agent/intents/”, if the error - is associated with certain intents. - - “projects//agent/intents//trainingPhrases/”, if the error is - associated with certain intent training phrases. - - “projects//agent/intents//parameters/”, if the error is - associated with certain intent parameters. - - “projects//agent/entities/”, if the error is associated with - certain entities. - error_message: - The detailed error messsage. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ValidationError) - }, -) -_sym_db.RegisterMessage(ValidationError) - -ValidationResult = _reflection.GeneratedProtocolMessageType( - "ValidationResult", - (_message.Message,), - { - "DESCRIPTOR": _VALIDATIONRESULT, - "__module__": "google.cloud.dialogflow_v2.proto.validation_result_pb2", - "__doc__": """Represents the output of agent validation. - - Attributes: - validation_errors: - Contains all validation errors. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.ValidationResult) - }, -) -_sym_db.RegisterMessage(ValidationResult) - - -DESCRIPTOR._options = None -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2/proto/validation_result_pb2_grpc.py b/dialogflow_v2/proto/validation_result_pb2_grpc.py deleted file mode 100644 index 8a9393943..000000000 --- a/dialogflow_v2/proto/validation_result_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/dialogflow_v2/proto/webhook_pb2.py b/dialogflow_v2/proto/webhook_pb2.py deleted file mode 100644 index 401c575f5..000000000 --- a/dialogflow_v2/proto/webhook_pb2.py +++ /dev/null @@ -1,560 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2/proto/webhook.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from dialogflow_v2.proto import ( - context_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2, -) -from dialogflow_v2.proto import ( - intent_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2, -) -from dialogflow_v2.proto import ( - session_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2, -) -from dialogflow_v2.proto import ( - session_entity_type_pb2 as google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2, -) -from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2/proto/webhook.proto", - package="google.cloud.dialogflow.v2", - syntax="proto3", - serialized_options=b"\n\036com.google.cloud.dialogflow.v2B\014WebhookProtoP\001ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\370\001\001\242\002\002DF\252\002\032Google.Cloud.Dialogflow.V2", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n.google/cloud/dialogflow_v2/proto/webhook.proto\x12\x1agoogle.cloud.dialogflow.v2\x1a.google/cloud/dialogflow_v2/proto/context.proto\x1a-google/cloud/dialogflow_v2/proto/intent.proto\x1a.google/cloud/dialogflow_v2/proto/session.proto\x1a:google/cloud/dialogflow_v2/proto/session_entity_type.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1cgoogle/api/annotations.proto"\xd6\x01\n\x0eWebhookRequest\x12\x0f\n\x07session\x18\x04 \x01(\t\x12\x13\n\x0bresponse_id\x18\x01 \x01(\t\x12=\n\x0cquery_result\x18\x02 \x01(\x0b\x32\'.google.cloud.dialogflow.v2.QueryResult\x12_\n\x1eoriginal_detect_intent_request\x18\x03 \x01(\x0b\x32\x37.google.cloud.dialogflow.v2.OriginalDetectIntentRequest"\x80\x03\n\x0fWebhookResponse\x12\x18\n\x10\x66ulfillment_text\x18\x01 \x01(\t\x12H\n\x14\x66ulfillment_messages\x18\x02 \x03(\x0b\x32*.google.cloud.dialogflow.v2.Intent.Message\x12\x0e\n\x06source\x18\x03 \x01(\t\x12(\n\x07payload\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12<\n\x0foutput_contexts\x18\x05 \x03(\x0b\x32#.google.cloud.dialogflow.v2.Context\x12\x44\n\x14\x66ollowup_event_input\x18\x06 \x01(\x0b\x32&.google.cloud.dialogflow.v2.EventInput\x12K\n\x14session_entity_types\x18\n \x03(\x0b\x32-.google.cloud.dialogflow.v2.SessionEntityType"h\n\x1bOriginalDetectIntentRequest\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12(\n\x07payload\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructB\x9b\x01\n\x1e\x63om.google.cloud.dialogflow.v2B\x0cWebhookProtoP\x01ZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1aGoogle.Cloud.Dialogflow.V2b\x06proto3', - dependencies=[ - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2.DESCRIPTOR, - google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - - -_WEBHOOKREQUEST = _descriptor.Descriptor( - name="WebhookRequest", - full_name="google.cloud.dialogflow.v2.WebhookRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="session", - full_name="google.cloud.dialogflow.v2.WebhookRequest.session", - index=0, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="response_id", - full_name="google.cloud.dialogflow.v2.WebhookRequest.response_id", - index=1, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_result", - full_name="google.cloud.dialogflow.v2.WebhookRequest.query_result", - index=2, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="original_detect_intent_request", - full_name="google.cloud.dialogflow.v2.WebhookRequest.original_detect_intent_request", - index=3, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=342, - serialized_end=556, -) - - -_WEBHOOKRESPONSE = _descriptor.Descriptor( - name="WebhookResponse", - full_name="google.cloud.dialogflow.v2.WebhookResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="fulfillment_text", - full_name="google.cloud.dialogflow.v2.WebhookResponse.fulfillment_text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="fulfillment_messages", - full_name="google.cloud.dialogflow.v2.WebhookResponse.fulfillment_messages", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="source", - full_name="google.cloud.dialogflow.v2.WebhookResponse.source", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="payload", - full_name="google.cloud.dialogflow.v2.WebhookResponse.payload", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_contexts", - full_name="google.cloud.dialogflow.v2.WebhookResponse.output_contexts", - index=4, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="followup_event_input", - full_name="google.cloud.dialogflow.v2.WebhookResponse.followup_event_input", - index=5, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="session_entity_types", - full_name="google.cloud.dialogflow.v2.WebhookResponse.session_entity_types", - index=6, - number=10, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=559, - serialized_end=943, -) - - -_ORIGINALDETECTINTENTREQUEST = _descriptor.Descriptor( - name="OriginalDetectIntentRequest", - full_name="google.cloud.dialogflow.v2.OriginalDetectIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="source", - full_name="google.cloud.dialogflow.v2.OriginalDetectIntentRequest.source", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="version", - full_name="google.cloud.dialogflow.v2.OriginalDetectIntentRequest.version", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="payload", - full_name="google.cloud.dialogflow.v2.OriginalDetectIntentRequest.payload", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=945, - serialized_end=1049, -) - -_WEBHOOKREQUEST.fields_by_name[ - "query_result" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2._QUERYRESULT -) -_WEBHOOKREQUEST.fields_by_name[ - "original_detect_intent_request" -].message_type = _ORIGINALDETECTINTENTREQUEST -_WEBHOOKRESPONSE.fields_by_name[ - "fulfillment_messages" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_intent__pb2._INTENT_MESSAGE -) -_WEBHOOKRESPONSE.fields_by_name[ - "payload" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_WEBHOOKRESPONSE.fields_by_name[ - "output_contexts" -].message_type = google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_context__pb2._CONTEXT -_WEBHOOKRESPONSE.fields_by_name[ - "followup_event_input" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__pb2._EVENTINPUT -) -_WEBHOOKRESPONSE.fields_by_name[ - "session_entity_types" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2_dot_proto_dot_session__entity__type__pb2._SESSIONENTITYTYPE -) -_ORIGINALDETECTINTENTREQUEST.fields_by_name[ - "payload" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -DESCRIPTOR.message_types_by_name["WebhookRequest"] = _WEBHOOKREQUEST -DESCRIPTOR.message_types_by_name["WebhookResponse"] = _WEBHOOKRESPONSE -DESCRIPTOR.message_types_by_name[ - "OriginalDetectIntentRequest" -] = _ORIGINALDETECTINTENTREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -WebhookRequest = _reflection.GeneratedProtocolMessageType( - "WebhookRequest", - (_message.Message,), - { - "DESCRIPTOR": _WEBHOOKREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.webhook_pb2", - "__doc__": """The request message for a webhook call. - - Attributes: - session: - The unique identifier of detectIntent request session. Can be - used to identify end-user inside webhook implementation. - Format: ``projects//agent/sessions/``, - or ``projects//agent/environments//users//sessions/``. - response_id: - The unique identifier of the response. Contains the same value - as ``[Streaming]DetectIntentResponse.response_id``. - query_result: - The result of the conversational query or event processing. - Contains the same value as - ``[Streaming]DetectIntentResponse.query_result``. - original_detect_intent_request: - Optional. The contents of the original request that was passed - to ``[Streaming]DetectIntent`` call. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.WebhookRequest) - }, -) -_sym_db.RegisterMessage(WebhookRequest) - -WebhookResponse = _reflection.GeneratedProtocolMessageType( - "WebhookResponse", - (_message.Message,), - { - "DESCRIPTOR": _WEBHOOKRESPONSE, - "__module__": "google.cloud.dialogflow_v2.proto.webhook_pb2", - "__doc__": """The response message for a webhook call. This response is validated - by the Dialogflow server. If validation fails, an error will be - returned in the [QueryResult.diagnostic_info][google.cloud.dialogflow. - v2.QueryResult.diagnostic_info] field. Setting JSON fields to an empty - value with the wrong type is a common error. To avoid this error: - - Use ``""`` for empty strings - Use ``{}`` or ``null`` for empty - objects - Use ``[]`` or ``null`` for empty arrays For more - information, see the `Protocol Buffers Language Guide - `__. - - Attributes: - fulfillment_text: - Optional. The text response message intended for the end-user. - It is recommended to use ``fulfillment_messages.text.text[0]`` - instead. When provided, Dialogflow uses this field to populate - [QueryResult.fulfillment_text][google.cloud.dialogflow.v2.Quer - yResult.fulfillment_text] sent to the integration or API - caller. - fulfillment_messages: - Optional. The rich response messages intended for the end- - user. When provided, Dialogflow uses this field to populate [Q - ueryResult.fulfillment_messages][google.cloud.dialogflow.v2.Qu - eryResult.fulfillment_messages] sent to the integration or API - caller. - source: - Optional. A custom field used to identify the webhook source. - Arbitrary strings are supported. When provided, Dialogflow - uses this field to populate [QueryResult.webhook_source][googl - e.cloud.dialogflow.v2.QueryResult.webhook_source] sent to the - integration or API caller. - payload: - Optional. This field can be used to pass custom data from your - webhook to the integration or API caller. Arbitrary JSON - objects are supported. When provided, Dialogflow uses this - field to populate [QueryResult.webhook_payload][google.cloud.d - ialogflow.v2.QueryResult.webhook_payload] sent to the - integration or API caller. This field is also used by the - `Google Assistant integration - `__ - for rich response messages. See the format definition at - `Google Assistant Dialogflow webhook format `__ - output_contexts: - Optional. The collection of output contexts that will - overwrite currently active contexts for the session and reset - their lifespans. When provided, Dialogflow uses this field to - populate [QueryResult.output_contexts][google.cloud.dialogflow - .v2.QueryResult.output_contexts] sent to the integration or - API caller. - followup_event_input: - Optional. Invokes the supplied events. When this field is set, - Dialogflow ignores the ``fulfillment_text``, - ``fulfillment_messages``, and ``payload`` fields. - session_entity_types: - Optional. Additional session entity types to replace or extend - developer entity types with. The entity synonyms apply to all - languages and persist for the session. Setting this data from - a webhook overwrites the session entity types that have been - set using ``detectIntent``, ``streamingDetectIntent`` or [Sess - ionEntityType][google.cloud.dialogflow.v2.SessionEntityType] - management methods. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.WebhookResponse) - }, -) -_sym_db.RegisterMessage(WebhookResponse) - -OriginalDetectIntentRequest = _reflection.GeneratedProtocolMessageType( - "OriginalDetectIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _ORIGINALDETECTINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2.proto.webhook_pb2", - "__doc__": """Represents the contents of the original request that was passed to the - ``[Streaming]DetectIntent`` call. - - Attributes: - source: - The source of this request, e.g., ``google``, ``facebook``, - ``slack``. It is set by Dialogflow-owned servers. - version: - Optional. The version of the protocol used for this request. - This field is AoG-specific. - payload: - Optional. This field is set to the value of the - ``QueryParameters.payload`` field passed in the request. Some - integrations that query a Dialogflow agent may provide - additional information in the payload. In particular, for the - Dialogflow Phone Gateway integration, this field has the form: - .. raw:: html
{     "telephony": {       "caller_id":
-          "+18558363987"     }    }
Note: The caller ID field - (``caller_id``) will be redacted for Standard Edition agents - and populated with the caller ID in `E.164 format - `__ for Enterprise - Edition agents. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2.OriginalDetectIntentRequest) - }, -) -_sym_db.RegisterMessage(OriginalDetectIntentRequest) - - -DESCRIPTOR._options = None -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2/proto/webhook_pb2_grpc.py b/dialogflow_v2/proto/webhook_pb2_grpc.py deleted file mode 100644 index 8a9393943..000000000 --- a/dialogflow_v2/proto/webhook_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/dialogflow_v2/types.py b/dialogflow_v2/types.py deleted file mode 100644 index c469ee666..000000000 --- a/dialogflow_v2/types.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -from __future__ import absolute_import -import sys - -from google.api_core.protobuf_helpers import get_messages - -from dialogflow_v2.proto import agent_pb2 -from dialogflow_v2.proto import audio_config_pb2 -from dialogflow_v2.proto import context_pb2 -from dialogflow_v2.proto import entity_type_pb2 -from dialogflow_v2.proto import environment_pb2 -from dialogflow_v2.proto import intent_pb2 -from dialogflow_v2.proto import session_entity_type_pb2 -from dialogflow_v2.proto import session_pb2 -from dialogflow_v2.proto import validation_result_pb2 -from dialogflow_v2.proto import webhook_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import any_pb2 -from google.protobuf import duration_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 -from google.protobuf import timestamp_pb2 -from google.rpc import status_pb2 -from google.type import latlng_pb2 - - -_shared_modules = [ - operations_pb2, - any_pb2, - duration_pb2, - empty_pb2, - field_mask_pb2, - struct_pb2, - timestamp_pb2, - status_pb2, - latlng_pb2, -] - -_local_modules = [ - agent_pb2, - audio_config_pb2, - context_pb2, - entity_type_pb2, - environment_pb2, - intent_pb2, - session_entity_type_pb2, - session_pb2, - validation_result_pb2, - webhook_pb2, -] - -names = [] - -for module in _shared_modules: # pragma: NO COVER - for name, message in get_messages(module).items(): - setattr(sys.modules[__name__], name, message) - names.append(name) -for module in _local_modules: - for name, message in get_messages(module).items(): - message.__module__ = "google.cloud.dialogflow_v2.types" - setattr(sys.modules[__name__], name, message) - names.append(name) - - -__all__ = tuple(sorted(names)) diff --git a/dialogflow_v2beta1/__init__.py b/dialogflow_v2beta1/__init__.py deleted file mode 100644 index 625580b0d..000000000 --- a/dialogflow_v2beta1/__init__.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -from __future__ import absolute_import -import sys -import warnings - -from dialogflow_v2beta1 import types -from dialogflow_v2beta1.gapic import agents_client -from dialogflow_v2beta1.gapic import contexts_client -from dialogflow_v2beta1.gapic import documents_client -from dialogflow_v2beta1.gapic import entity_types_client -from dialogflow_v2beta1.gapic import enums -from dialogflow_v2beta1.gapic import environments_client -from dialogflow_v2beta1.gapic import intents_client -from dialogflow_v2beta1.gapic import knowledge_bases_client -from dialogflow_v2beta1.gapic import session_entity_types_client -from dialogflow_v2beta1.gapic import sessions_client - - -if sys.version_info[:2] == (2, 7): - message = ( - "A future version of this library will drop support for Python 2.7. " - "More details about Python 2 support for Google Cloud Client Libraries " - "can be found at https://cloud.google.com/python/docs/python2-sunset/" - ) - warnings.warn(message, DeprecationWarning) - - -class EnvironmentsClient(environments_client.EnvironmentsClient): - __doc__ = environments_client.EnvironmentsClient.__doc__ - enums = enums - - -class AgentsClient(agents_client.AgentsClient): - __doc__ = agents_client.AgentsClient.__doc__ - enums = enums - - -class ContextsClient(contexts_client.ContextsClient): - __doc__ = contexts_client.ContextsClient.__doc__ - enums = enums - - -class DocumentsClient(documents_client.DocumentsClient): - __doc__ = documents_client.DocumentsClient.__doc__ - enums = enums - - -class EntityTypesClient(entity_types_client.EntityTypesClient): - __doc__ = entity_types_client.EntityTypesClient.__doc__ - enums = enums - - -class IntentsClient(intents_client.IntentsClient): - __doc__ = intents_client.IntentsClient.__doc__ - enums = enums - - -class KnowledgeBasesClient(knowledge_bases_client.KnowledgeBasesClient): - __doc__ = knowledge_bases_client.KnowledgeBasesClient.__doc__ - enums = enums - - -class SessionEntityTypesClient(session_entity_types_client.SessionEntityTypesClient): - __doc__ = session_entity_types_client.SessionEntityTypesClient.__doc__ - enums = enums - - -class SessionsClient(sessions_client.SessionsClient): - __doc__ = sessions_client.SessionsClient.__doc__ - enums = enums - - -__all__ = ( - "enums", - "types", - "EnvironmentsClient", - "AgentsClient", - "ContextsClient", - "DocumentsClient", - "EntityTypesClient", - "IntentsClient", - "KnowledgeBasesClient", - "SessionEntityTypesClient", - "SessionsClient", -) diff --git a/dialogflow_v2beta1/gapic/__init__.py b/dialogflow_v2beta1/gapic/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/dialogflow_v2beta1/gapic/agents_client.py b/dialogflow_v2beta1/gapic/agents_client.py deleted file mode 100644 index a86399486..000000000 --- a/dialogflow_v2beta1/gapic/agents_client.py +++ /dev/null @@ -1,1010 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2beta1 Agents API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.operation -import google.api_core.operations_v1 -import google.api_core.page_iterator -import google.api_core.path_template -import google.api_core.protobuf_helpers -import grpc - -from dialogflow_v2beta1.gapic import agents_client_config -from dialogflow_v2beta1.gapic import enums -from dialogflow_v2beta1.gapic.transports import agents_grpc_transport -from dialogflow_v2beta1.proto import agent_pb2 -from dialogflow_v2beta1.proto import agent_pb2_grpc -from dialogflow_v2beta1.proto import environment_pb2 -from dialogflow_v2beta1.proto import environment_pb2_grpc -from dialogflow_v2beta1.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class AgentsClient(object): - """Service for managing ``Agents``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2beta1.Agents" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2beta1.AgentsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def location_path(cls, project, location): - """Return a fully-qualified location string.""" - return google.api_core.path_template.expand( - "projects/{project}/locations/{location}", - project=project, - location=location, - ) - - @classmethod - def project_path(cls, project): - """Return a fully-qualified project string.""" - return google.api_core.path_template.expand( - "projects/{project}", project=project - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.AgentsGrpcTransport, - Callable[[~.Credentials, type], ~.AgentsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = agents_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=agents_grpc_transport.AgentsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = agents_grpc_transport.AgentsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def get_agent( - self, - parent, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified agent. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.get_agent(parent) - - Args: - parent (str): Required. The project that the agent to fetch is associated with. - Format: ``projects/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.Agent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "get_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_agent, - default_retry=self._method_configs["GetAgent"].retry, - default_timeout=self._method_configs["GetAgent"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.GetAgentRequest(parent=parent) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def set_agent( - self, - agent, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates/updates the specified agent. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.AgentsClient() - >>> - >>> # TODO: Initialize `agent`: - >>> agent = {} - >>> - >>> response = client.set_agent(agent) - - Args: - agent (Union[dict, ~google.cloud.dialogflow_v2beta1.types.Agent]): Required. The agent to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.Agent` - update_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.Agent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "set_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "set_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.set_agent, - default_retry=self._method_configs["SetAgent"].retry, - default_timeout=self._method_configs["SetAgent"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.SetAgentRequest(agent=agent, update_mask=update_mask) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("agent.parent", agent.parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["set_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_agent( - self, - parent, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified agent. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> client.delete_agent(parent) - - Args: - parent (str): Required. The project that the agent to delete is associated with. - Format: ``projects/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_agent, - default_retry=self._method_configs["DeleteAgent"].retry, - default_timeout=self._method_configs["DeleteAgent"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.DeleteAgentRequest(parent=parent) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def search_agents( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of agents. Since there is at most one - conversational agent per project, this method is useful primarily for - listing all agents across projects the caller has access to. One can - achieve that with a wildcard project collection id "-". Refer to `List - Sub-Collections `__. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> # Iterate over all results - >>> for element in client.search_agents(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.search_agents(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The project to list agents from. Format: - ``projects/``. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2beta1.types.Agent` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "search_agents" not in self._inner_api_calls: - self._inner_api_calls[ - "search_agents" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.search_agents, - default_retry=self._method_configs["SearchAgents"].retry, - default_timeout=self._method_configs["SearchAgents"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.SearchAgentsRequest(parent=parent, page_size=page_size) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["search_agents"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="agents", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def train_agent( - self, - parent, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Trains the specified agent. - - Operation - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.train_agent(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The project that the agent to train is associated with. - Format: ``projects/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "train_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "train_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.train_agent, - default_retry=self._method_configs["TrainAgent"].retry, - default_timeout=self._method_configs["TrainAgent"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.TrainAgentRequest(parent=parent) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["train_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def export_agent( - self, - parent, - agent_uri=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Exports the specified agent to a ZIP file. - - Operation - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.export_agent(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The project that the agent to export is associated with. - Format: ``projects/``. - agent_uri (str): Optional. The `Google Cloud - Storage `__ URI to export the - agent to. The format of this URI must be - ``gs:///``. If left unspecified, the - serialized agent is returned inline. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "export_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "export_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.export_agent, - default_retry=self._method_configs["ExportAgent"].retry, - default_timeout=self._method_configs["ExportAgent"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.ExportAgentRequest(parent=parent, agent_uri=agent_uri) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["export_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - agent_pb2.ExportAgentResponse, - metadata_type=struct_pb2.Struct, - ) - - def import_agent( - self, - parent, - agent_uri=None, - agent_content=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Imports the specified agent from a ZIP file. - - Uploads new intents and entity types without deleting the existing ones. - Intents and entity types with the same name are replaced with the new - versions from ``ImportAgentRequest``. After the import, the imported - draft agent will be trained automatically (unless disabled in agent - settings). However, once the import is done, training may not be - completed yet. Please call ``TrainAgent`` and wait for the operation it - returns in order to train explicitly. - - Operation An operation which - tracks when importing is complete. It only tracks when the draft agent - is updated not when it is done training. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.import_agent(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The project that the agent to import is associated with. - Format: ``projects/``. - agent_uri (str): The URI to a Google Cloud Storage file containing the agent to import. - Note: The URI must start with "gs://". - agent_content (bytes): Zip compressed raw byte content for agent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "import_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "import_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.import_agent, - default_retry=self._method_configs["ImportAgent"].retry, - default_timeout=self._method_configs["ImportAgent"].timeout, - client_info=self._client_info, - ) - - # Sanity check: We have some fields which are mutually exclusive; - # raise ValueError if more than one is sent. - google.api_core.protobuf_helpers.check_oneof( - agent_uri=agent_uri, agent_content=agent_content - ) - - request = agent_pb2.ImportAgentRequest( - parent=parent, agent_uri=agent_uri, agent_content=agent_content - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["import_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def restore_agent( - self, - parent, - agent_uri=None, - agent_content=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Restores the specified agent from a ZIP file. - - Replaces the current agent version with a new one. All the intents and - entity types in the older version are deleted. After the restore, the - restored draft agent will be trained automatically (unless disabled in - agent settings). However, once the restore is done, training may not be - completed yet. Please call ``TrainAgent`` and wait for the operation it - returns in order to train explicitly. - - Operation An operation which - tracks when restoring is complete. It only tracks when the draft agent - is updated not when it is done training. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.restore_agent(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The project that the agent to restore is associated with. - Format: ``projects/``. - agent_uri (str): The URI to a Google Cloud Storage file containing the agent to restore. - Note: The URI must start with "gs://". - agent_content (bytes): Zip compressed raw byte content for agent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "restore_agent" not in self._inner_api_calls: - self._inner_api_calls[ - "restore_agent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.restore_agent, - default_retry=self._method_configs["RestoreAgent"].retry, - default_timeout=self._method_configs["RestoreAgent"].timeout, - client_info=self._client_info, - ) - - # Sanity check: We have some fields which are mutually exclusive; - # raise ValueError if more than one is sent. - google.api_core.protobuf_helpers.check_oneof( - agent_uri=agent_uri, agent_content=agent_content - ) - - request = agent_pb2.RestoreAgentRequest( - parent=parent, agent_uri=agent_uri, agent_content=agent_content - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["restore_agent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def get_validation_result( - self, - parent=None, - language_code=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Gets agent validation result. Agent validation is performed during - training time and is updated automatically when training is completed. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.AgentsClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> response = client.get_validation_result(parent) - - Args: - parent (str): Required. The project that the agent is associated with. Format: - ``projects/``. - language_code (str): Optional. The language for which you want a validation result. If - not specified, the agent's default language is used. `Many - languages `__ - are supported. Note: languages must be enabled in the agent before they - can be used. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.ValidationResult` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_validation_result" not in self._inner_api_calls: - self._inner_api_calls[ - "get_validation_result" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_validation_result, - default_retry=self._method_configs["GetValidationResult"].retry, - default_timeout=self._method_configs["GetValidationResult"].timeout, - client_info=self._client_info, - ) - - request = agent_pb2.GetValidationResultRequest( - parent=parent, language_code=language_code - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_validation_result"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/dialogflow_v2beta1/gapic/agents_client_config.py b/dialogflow_v2beta1/gapic/agents_client_config.py deleted file mode 100644 index d8a13d0f7..000000000 --- a/dialogflow_v2beta1/gapic/agents_client_config.py +++ /dev/null @@ -1,107 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2beta1.Agents": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_3_codes": ["UNAVAILABLE"], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 180000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 180000, - "total_timeout_millis": 180000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "GetAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "SetAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "SearchAgents": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "TrainAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "ExportAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "ImportAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "RestoreAgent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetValidationResult": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2beta1/gapic/contexts_client.py b/dialogflow_v2beta1/gapic/contexts_client.py deleted file mode 100644 index dfe422bb2..000000000 --- a/dialogflow_v2beta1/gapic/contexts_client.py +++ /dev/null @@ -1,729 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2beta1 Contexts API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from dialogflow_v2beta1.gapic import contexts_client_config -from dialogflow_v2beta1.gapic import enums -from dialogflow_v2beta1.gapic.transports import contexts_grpc_transport -from dialogflow_v2beta1.proto import agent_pb2 -from dialogflow_v2beta1.proto import agent_pb2_grpc -from dialogflow_v2beta1.proto import context_pb2 -from dialogflow_v2beta1.proto import context_pb2_grpc -from dialogflow_v2beta1.proto import environment_pb2 -from dialogflow_v2beta1.proto import environment_pb2_grpc -from dialogflow_v2beta1.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class ContextsClient(object): - """Service for managing ``Contexts``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2beta1.Contexts" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2beta1.ContextsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def context_path(cls, project, session, context): - """Return a fully-qualified context string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/sessions/{session}/contexts/{context}", - project=project, - session=session, - context=context, - ) - - @classmethod - def environment_context_path(cls, project, environment, user, session, context): - """Return a fully-qualified environment_context string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}", - project=project, - environment=environment, - user=user, - session=session, - context=context, - ) - - @classmethod - def environment_session_path(cls, project, environment, user, session): - """Return a fully-qualified environment_session string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}", - project=project, - environment=environment, - user=user, - session=session, - ) - - @classmethod - def session_path(cls, project, session): - """Return a fully-qualified session string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/sessions/{session}", - project=project, - session=session, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.ContextsGrpcTransport, - Callable[[~.Credentials, type], ~.ContextsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = contexts_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=contexts_grpc_transport.ContextsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = contexts_grpc_transport.ContextsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_contexts( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all contexts in the specified session. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.ContextsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # Iterate over all results - >>> for element in client.list_contexts(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_contexts(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The session to list all contexts from. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users//sessions/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2beta1.types.Context` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_contexts" not in self._inner_api_calls: - self._inner_api_calls[ - "list_contexts" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_contexts, - default_retry=self._method_configs["ListContexts"].retry, - default_timeout=self._method_configs["ListContexts"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.ListContextsRequest(parent=parent, page_size=page_size) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_contexts"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="contexts", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def get_context( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified context. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.ContextsClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> response = client.get_context(name) - - Args: - name (str): Required. The name of the context. Format: - ``projects//agent/sessions//contexts/`` - or - ``projects//agent/environments//users//sessions//contexts/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.Context` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_context" not in self._inner_api_calls: - self._inner_api_calls[ - "get_context" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_context, - default_retry=self._method_configs["GetContext"].retry, - default_timeout=self._method_configs["GetContext"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.GetContextRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_context"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_context( - self, - parent, - context, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a context. - - If the specified context already exists, overrides the context. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.ContextsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `context`: - >>> context = {} - >>> - >>> response = client.create_context(parent, context) - - Args: - parent (str): Required. The session to create a context for. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users//sessions/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - context (Union[dict, ~google.cloud.dialogflow_v2beta1.types.Context]): Required. The context to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.Context` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.Context` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_context" not in self._inner_api_calls: - self._inner_api_calls[ - "create_context" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_context, - default_retry=self._method_configs["CreateContext"].retry, - default_timeout=self._method_configs["CreateContext"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.CreateContextRequest(parent=parent, context=context) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_context"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_context( - self, - context, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified context. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.ContextsClient() - >>> - >>> # TODO: Initialize `context`: - >>> context = {} - >>> - >>> response = client.update_context(context) - - Args: - context (Union[dict, ~google.cloud.dialogflow_v2beta1.types.Context]): Required. The context to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.Context` - update_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.Context` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_context" not in self._inner_api_calls: - self._inner_api_calls[ - "update_context" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_context, - default_retry=self._method_configs["UpdateContext"].retry, - default_timeout=self._method_configs["UpdateContext"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.UpdateContextRequest( - context=context, update_mask=update_mask - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("context.name", context.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_context"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_context( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified context. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.ContextsClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> client.delete_context(name) - - Args: - name (str): Required. The name of the context to delete. Format: - ``projects//agent/sessions//contexts/`` - or - ``projects//agent/environments//users//sessions//contexts/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_context" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_context" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_context, - default_retry=self._method_configs["DeleteContext"].retry, - default_timeout=self._method_configs["DeleteContext"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.DeleteContextRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_context"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_all_contexts( - self, - parent, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes all active contexts in the specified session. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.ContextsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> client.delete_all_contexts(parent) - - Args: - parent (str): Required. The name of the session to delete all contexts from. - Format: ``projects//agent/sessions/`` or - ``projects//agent/environments//users//sessions/``. - If ``Environment ID`` is not specified we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_all_contexts" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_all_contexts" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_all_contexts, - default_retry=self._method_configs["DeleteAllContexts"].retry, - default_timeout=self._method_configs["DeleteAllContexts"].timeout, - client_info=self._client_info, - ) - - request = context_pb2.DeleteAllContextsRequest(parent=parent) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_all_contexts"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/dialogflow_v2beta1/gapic/contexts_client_config.py b/dialogflow_v2beta1/gapic/contexts_client_config.py deleted file mode 100644 index 7861c060c..000000000 --- a/dialogflow_v2beta1/gapic/contexts_client_config.py +++ /dev/null @@ -1,92 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2beta1.Contexts": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_3_codes": ["UNAVAILABLE"], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 180000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 180000, - "total_timeout_millis": 180000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListContexts": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetContext": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "CreateContext": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateContext": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteContext": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteAllContexts": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2beta1/gapic/documents_client.py b/dialogflow_v2beta1/gapic/documents_client.py deleted file mode 100644 index dd2cb065a..000000000 --- a/dialogflow_v2beta1/gapic/documents_client.py +++ /dev/null @@ -1,783 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2beta1 Documents API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.operation -import google.api_core.operations_v1 -import google.api_core.page_iterator -import google.api_core.path_template -import google.api_core.protobuf_helpers -import grpc - -from dialogflow_v2beta1.gapic import documents_client_config -from dialogflow_v2beta1.gapic import enums -from dialogflow_v2beta1.gapic.transports import documents_grpc_transport -from dialogflow_v2beta1.proto import agent_pb2 -from dialogflow_v2beta1.proto import agent_pb2_grpc -from dialogflow_v2beta1.proto import context_pb2 -from dialogflow_v2beta1.proto import context_pb2_grpc -from dialogflow_v2beta1.proto import document_pb2 -from dialogflow_v2beta1.proto import document_pb2_grpc -from dialogflow_v2beta1.proto import environment_pb2 -from dialogflow_v2beta1.proto import environment_pb2_grpc -from dialogflow_v2beta1.proto import gcs_pb2 -from dialogflow_v2beta1.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class DocumentsClient(object): - """Service for managing knowledge ``Documents``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2beta1.Documents" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2beta1.DocumentsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def document_path(cls, project, knowledge_base, document): - """Return a fully-qualified document string.""" - return google.api_core.path_template.expand( - "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}", - project=project, - knowledge_base=knowledge_base, - document=document, - ) - - @classmethod - def knowledge_base_path(cls, project, knowledge_base): - """Return a fully-qualified knowledge_base string.""" - return google.api_core.path_template.expand( - "projects/{project}/knowledgeBases/{knowledge_base}", - project=project, - knowledge_base=knowledge_base, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.DocumentsGrpcTransport, - Callable[[~.Credentials, type], ~.DocumentsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = documents_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=documents_grpc_transport.DocumentsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = documents_grpc_transport.DocumentsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_documents( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all documents of the knowledge base. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.DocumentsClient() - >>> - >>> parent = client.knowledge_base_path('[PROJECT]', '[KNOWLEDGE_BASE]') - >>> - >>> # Iterate over all results - >>> for element in client.list_documents(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_documents(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The knowledge base to list all documents for. Format: - ``projects//knowledgeBases/``. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2beta1.types.Document` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_documents" not in self._inner_api_calls: - self._inner_api_calls[ - "list_documents" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_documents, - default_retry=self._method_configs["ListDocuments"].retry, - default_timeout=self._method_configs["ListDocuments"].timeout, - client_info=self._client_info, - ) - - request = document_pb2.ListDocumentsRequest(parent=parent, page_size=page_size) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_documents"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="documents", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def get_document( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified document. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.DocumentsClient() - >>> - >>> name = client.document_path('[PROJECT]', '[KNOWLEDGE_BASE]', '[DOCUMENT]') - >>> - >>> response = client.get_document(name) - - Args: - name (str): Required. The name of the document to retrieve. Format - ``projects//knowledgeBases//documents/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.Document` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_document" not in self._inner_api_calls: - self._inner_api_calls[ - "get_document" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_document, - default_retry=self._method_configs["GetDocument"].retry, - default_timeout=self._method_configs["GetDocument"].timeout, - client_info=self._client_info, - ) - - request = document_pb2.GetDocumentRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_document"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_document( - self, - parent, - document, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a new document. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.DocumentsClient() - >>> - >>> parent = client.knowledge_base_path('[PROJECT]', '[KNOWLEDGE_BASE]') - >>> - >>> # TODO: Initialize `document`: - >>> document = {} - >>> - >>> response = client.create_document(parent, document) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The knoweldge base to create a document for. Format: - ``projects//knowledgeBases/``. - document (Union[dict, ~google.cloud.dialogflow_v2beta1.types.Document]): Required. The document to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.Document` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_document" not in self._inner_api_calls: - self._inner_api_calls[ - "create_document" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_document, - default_retry=self._method_configs["CreateDocument"].retry, - default_timeout=self._method_configs["CreateDocument"].timeout, - client_info=self._client_info, - ) - - request = document_pb2.CreateDocumentRequest(parent=parent, document=document) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["create_document"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - document_pb2.Document, - metadata_type=document_pb2.KnowledgeOperationMetadata, - ) - - def delete_document( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified document. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.DocumentsClient() - >>> - >>> name = client.document_path('[PROJECT]', '[KNOWLEDGE_BASE]', '[DOCUMENT]') - >>> - >>> response = client.delete_document(name) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - name (str): Required. The name of the document to delete. Format: - ``projects//knowledgeBases//documents/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_document" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_document" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_document, - default_retry=self._method_configs["DeleteDocument"].retry, - default_timeout=self._method_configs["DeleteDocument"].timeout, - client_info=self._client_info, - ) - - request = document_pb2.DeleteDocumentRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["delete_document"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=document_pb2.KnowledgeOperationMetadata, - ) - - def update_document( - self, - document, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified document. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.DocumentsClient() - >>> - >>> # TODO: Initialize `document`: - >>> document = {} - >>> - >>> response = client.update_document(document) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - document (Union[dict, ~google.cloud.dialogflow_v2beta1.types.Document]): Required. The document to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.Document` - update_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Optional. Not specified means ``update all``. Currently, only - ``display_name`` can be updated, an InvalidArgument will be returned for - attempting to update other fields. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_document" not in self._inner_api_calls: - self._inner_api_calls[ - "update_document" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_document, - default_retry=self._method_configs["UpdateDocument"].retry, - default_timeout=self._method_configs["UpdateDocument"].timeout, - client_info=self._client_info, - ) - - request = document_pb2.UpdateDocumentRequest( - document=document, update_mask=update_mask - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("document.name", document.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["update_document"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - document_pb2.Document, - metadata_type=document_pb2.KnowledgeOperationMetadata, - ) - - def reload_document( - self, - name=None, - gcs_source=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Reloads the specified document from its specified source, - content_uri or content. The previously loaded content of the document - will be deleted. Note: Even when the content of the document has not - changed, there still may be side effects because of internal - implementation changes. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.DocumentsClient() - >>> - >>> name = client.document_path('[PROJECT]', '[KNOWLEDGE_BASE]', '[DOCUMENT]') - >>> - >>> response = client.reload_document(name) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - name (str): Required. The name of the document to reload. Format: - ``projects//knowledgeBases//documents/`` - gcs_source (Union[dict, ~google.cloud.dialogflow_v2beta1.types.GcsSource]): The path for a Cloud Storage source file for reloading document content. - If not provided, the Document's existing source will be reloaded. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.GcsSource` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "reload_document" not in self._inner_api_calls: - self._inner_api_calls[ - "reload_document" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.reload_document, - default_retry=self._method_configs["ReloadDocument"].retry, - default_timeout=self._method_configs["ReloadDocument"].timeout, - client_info=self._client_info, - ) - - # Sanity check: We have some fields which are mutually exclusive; - # raise ValueError if more than one is sent. - google.api_core.protobuf_helpers.check_oneof(gcs_source=gcs_source) - - request = document_pb2.ReloadDocumentRequest(name=name, gcs_source=gcs_source) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["reload_document"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - document_pb2.Document, - metadata_type=document_pb2.KnowledgeOperationMetadata, - ) diff --git a/dialogflow_v2beta1/gapic/documents_client_config.py b/dialogflow_v2beta1/gapic/documents_client_config.py deleted file mode 100644 index 533abc6a2..000000000 --- a/dialogflow_v2beta1/gapic/documents_client_config.py +++ /dev/null @@ -1,92 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2beta1.Documents": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_3_codes": ["UNAVAILABLE"], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 180000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 180000, - "total_timeout_millis": 180000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListDocuments": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetDocument": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "CreateDocument": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteDocument": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateDocument": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "ReloadDocument": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2beta1/gapic/entity_types_client.py b/dialogflow_v2beta1/gapic/entity_types_client.py deleted file mode 100644 index 0f7a09ba7..000000000 --- a/dialogflow_v2beta1/gapic/entity_types_client.py +++ /dev/null @@ -1,1188 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2beta1 EntityTypes API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.operation -import google.api_core.operations_v1 -import google.api_core.page_iterator -import google.api_core.path_template -import google.api_core.protobuf_helpers -import grpc - -from dialogflow_v2beta1.gapic import entity_types_client_config -from dialogflow_v2beta1.gapic import enums -from dialogflow_v2beta1.gapic.transports import entity_types_grpc_transport -from dialogflow_v2beta1.proto import agent_pb2 -from dialogflow_v2beta1.proto import agent_pb2_grpc -from dialogflow_v2beta1.proto import context_pb2 -from dialogflow_v2beta1.proto import context_pb2_grpc -from dialogflow_v2beta1.proto import document_pb2 -from dialogflow_v2beta1.proto import document_pb2_grpc -from dialogflow_v2beta1.proto import entity_type_pb2 -from dialogflow_v2beta1.proto import entity_type_pb2_grpc -from dialogflow_v2beta1.proto import environment_pb2 -from dialogflow_v2beta1.proto import environment_pb2_grpc -from dialogflow_v2beta1.proto import gcs_pb2 -from dialogflow_v2beta1.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class EntityTypesClient(object): - """Service for managing ``EntityTypes``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2beta1.EntityTypes" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2beta1.EntityTypesClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def project_agent_path(cls, project): - """Return a fully-qualified project_agent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent", project=project - ) - - @classmethod - def agent_path(cls, project): - """Return a fully-qualified agent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent", project=project - ) - - @classmethod - def entity_type_path(cls, project, entity_type): - """Return a fully-qualified entity_type string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/entityTypes/{entity_type}", - project=project, - entity_type=entity_type, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.EntityTypesGrpcTransport, - Callable[[~.Credentials, type], ~.EntityTypesGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = entity_types_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=entity_types_grpc_transport.EntityTypesGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = entity_types_grpc_transport.EntityTypesGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_entity_types( - self, - parent, - language_code=None, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all entity types in the specified agent. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # Iterate over all results - >>> for element in client.list_entity_types(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_entity_types(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The agent to list all entity types from. Format: - ``projects//agent``. - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2beta1.types.EntityType` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_entity_types" not in self._inner_api_calls: - self._inner_api_calls[ - "list_entity_types" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_entity_types, - default_retry=self._method_configs["ListEntityTypes"].retry, - default_timeout=self._method_configs["ListEntityTypes"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.ListEntityTypesRequest( - parent=parent, language_code=language_code, page_size=page_size - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_entity_types"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="entity_types", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def get_entity_type( - self, - name, - language_code=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified entity type. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EntityTypesClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> response = client.get_entity_type(name) - - Args: - name (str): Required. The name of the entity type. Format: - ``projects//agent/entityTypes/``. - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.EntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "get_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_entity_type, - default_retry=self._method_configs["GetEntityType"].retry, - default_timeout=self._method_configs["GetEntityType"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.GetEntityTypeRequest( - name=name, language_code=language_code - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_entity_type( - self, - parent, - entity_type, - language_code=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates an entity type in the specified agent. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `entity_type`: - >>> entity_type = {} - >>> - >>> response = client.create_entity_type(parent, entity_type) - - Args: - parent (str): Required. The agent to create a entity type for. Format: - ``projects//agent``. - entity_type (Union[dict, ~google.cloud.dialogflow_v2beta1.types.EntityType]): Required. The entity type to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.EntityType` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.EntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "create_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_entity_type, - default_retry=self._method_configs["CreateEntityType"].retry, - default_timeout=self._method_configs["CreateEntityType"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.CreateEntityTypeRequest( - parent=parent, entity_type=entity_type, language_code=language_code - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_entity_type( - self, - entity_type, - language_code=None, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified entity type. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EntityTypesClient() - >>> - >>> # TODO: Initialize `entity_type`: - >>> entity_type = {} - >>> - >>> response = client.update_entity_type(entity_type) - - Args: - entity_type (Union[dict, ~google.cloud.dialogflow_v2beta1.types.EntityType]): Required. The entity type to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.EntityType` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - update_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.EntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "update_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_entity_type, - default_retry=self._method_configs["UpdateEntityType"].retry, - default_timeout=self._method_configs["UpdateEntityType"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.UpdateEntityTypeRequest( - entity_type=entity_type, - language_code=language_code, - update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("entity_type.name", entity_type.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_entity_type( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified entity type. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EntityTypesClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> client.delete_entity_type(name) - - Args: - name (str): Required. The name of the entity type to delete. Format: - ``projects//agent/entityTypes/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_entity_type, - default_retry=self._method_configs["DeleteEntityType"].retry, - default_timeout=self._method_configs["DeleteEntityType"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.DeleteEntityTypeRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def batch_update_entity_types( - self, - parent, - entity_type_batch_uri=None, - entity_type_batch_inline=None, - language_code=None, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates/Creates multiple entity types in the specified agent. - Operation - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> response = client.batch_update_entity_types(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the agent to update or create entity types in. - Format: ``projects//agent``. - entity_type_batch_uri (str): The URI to a Google Cloud Storage file containing entity types to update - or create. The file format can either be a serialized proto (of - EntityBatch type) or a JSON object. Note: The URI must start with - "gs://". - entity_type_batch_inline (Union[dict, ~google.cloud.dialogflow_v2beta1.types.EntityTypeBatch]): The collection of entity types to update or create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.EntityTypeBatch` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - update_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_update_entity_types" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_update_entity_types" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_update_entity_types, - default_retry=self._method_configs["BatchUpdateEntityTypes"].retry, - default_timeout=self._method_configs["BatchUpdateEntityTypes"].timeout, - client_info=self._client_info, - ) - - # Sanity check: We have some fields which are mutually exclusive; - # raise ValueError if more than one is sent. - google.api_core.protobuf_helpers.check_oneof( - entity_type_batch_uri=entity_type_batch_uri, - entity_type_batch_inline=entity_type_batch_inline, - ) - - request = entity_type_pb2.BatchUpdateEntityTypesRequest( - parent=parent, - entity_type_batch_uri=entity_type_batch_uri, - entity_type_batch_inline=entity_type_batch_inline, - language_code=language_code, - update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_update_entity_types"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - entity_type_pb2.BatchUpdateEntityTypesResponse, - metadata_type=struct_pb2.Struct, - ) - - def batch_delete_entity_types( - self, - parent, - entity_type_names, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes entity types in the specified agent. Operation - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `entity_type_names`: - >>> entity_type_names = [] - >>> - >>> response = client.batch_delete_entity_types(parent, entity_type_names) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the agent to delete all entities types for. - Format: ``projects//agent``. - entity_type_names (list[str]): Required. The names entity types to delete. All names must point to - the same agent as ``parent``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_delete_entity_types" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_delete_entity_types" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_delete_entity_types, - default_retry=self._method_configs["BatchDeleteEntityTypes"].retry, - default_timeout=self._method_configs["BatchDeleteEntityTypes"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.BatchDeleteEntityTypesRequest( - parent=parent, entity_type_names=entity_type_names - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_delete_entity_types"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def batch_create_entities( - self, - parent, - entities, - language_code=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates multiple new entities in the specified entity type. - - Operation - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `entities`: - >>> entities = [] - >>> - >>> response = client.batch_create_entities(parent, entities) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the entity type to create entities in. Format: - ``projects//agent/entityTypes/``. - entities (list[Union[dict, ~google.cloud.dialogflow_v2beta1.types.Entity]]): Required. The entities to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.Entity` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_create_entities" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_create_entities" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_create_entities, - default_retry=self._method_configs["BatchCreateEntities"].retry, - default_timeout=self._method_configs["BatchCreateEntities"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.BatchCreateEntitiesRequest( - parent=parent, entities=entities, language_code=language_code - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_create_entities"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def batch_update_entities( - self, - parent, - entities, - language_code=None, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates or creates multiple entities in the specified entity type. - This method does not affect entities in the entity type that aren't - explicitly specified in the request. - - Operation - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `entities`: - >>> entities = [] - >>> - >>> response = client.batch_update_entities(parent, entities) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the entity type to update or create entities - in. Format: - ``projects//agent/entityTypes/``. - entities (list[Union[dict, ~google.cloud.dialogflow_v2beta1.types.Entity]]): Required. The entities to update or create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.Entity` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - update_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_update_entities" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_update_entities" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_update_entities, - default_retry=self._method_configs["BatchUpdateEntities"].retry, - default_timeout=self._method_configs["BatchUpdateEntities"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.BatchUpdateEntitiesRequest( - parent=parent, - entities=entities, - language_code=language_code, - update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_update_entities"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) - - def batch_delete_entities( - self, - parent, - entity_values, - language_code=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes entities in the specified entity type. - - Operation - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `entity_values`: - >>> entity_values = [] - >>> - >>> response = client.batch_delete_entities(parent, entity_values) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the entity type to delete entries for. Format: - ``projects//agent/entityTypes/``. - entity_values (list[str]): Required. The reference ``values`` of the entities to delete. Note - that these are not fully-qualified names, i.e. they don't start with - ``projects/``. - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_delete_entities" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_delete_entities" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_delete_entities, - default_retry=self._method_configs["BatchDeleteEntities"].retry, - default_timeout=self._method_configs["BatchDeleteEntities"].timeout, - client_info=self._client_info, - ) - - request = entity_type_pb2.BatchDeleteEntitiesRequest( - parent=parent, entity_values=entity_values, language_code=language_code - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_delete_entities"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) diff --git a/dialogflow_v2beta1/gapic/entity_types_client_config.py b/dialogflow_v2beta1/gapic/entity_types_client_config.py deleted file mode 100644 index d4b2a8432..000000000 --- a/dialogflow_v2beta1/gapic/entity_types_client_config.py +++ /dev/null @@ -1,112 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2beta1.EntityTypes": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_3_codes": ["UNAVAILABLE"], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 180000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 180000, - "total_timeout_millis": 180000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "CreateEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchUpdateEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchDeleteEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchCreateEntities": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchUpdateEntities": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchDeleteEntities": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2beta1/gapic/enums.py b/dialogflow_v2beta1/gapic/enums.py deleted file mode 100644 index 8277dfa8c..000000000 --- a/dialogflow_v2beta1/gapic/enums.py +++ /dev/null @@ -1,630 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Wrappers for protocol buffer enum types.""" - -import enum - - -class AudioEncoding(enum.IntEnum): - """ - Audio encoding of the audio content sent in the conversational query - request. Refer to the `Cloud Speech API - documentation `__ - for more details. - - Attributes: - AUDIO_ENCODING_UNSPECIFIED (int): Not specified. - AUDIO_ENCODING_LINEAR_16 (int): Uncompressed 16-bit signed little-endian samples (Linear PCM). - AUDIO_ENCODING_FLAC (int): ```FLAC`` `__ (Free - Lossless Audio Codec) is the recommended encoding because it is lossless - (therefore recognition is not compromised) and requires only about half - the bandwidth of ``LINEAR16``. ``FLAC`` stream encoding supports 16-bit - and 24-bit samples, however, not all fields in ``STREAMINFO`` are - supported. - AUDIO_ENCODING_MULAW (int): 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. - AUDIO_ENCODING_AMR (int): Adaptive Multi-Rate Narrowband codec. ``sample_rate_hertz`` must be - 8000. - AUDIO_ENCODING_AMR_WB (int): Adaptive Multi-Rate Wideband codec. ``sample_rate_hertz`` must be - 16000. - AUDIO_ENCODING_OGG_OPUS (int): Opus encoded audio frames in Ogg container - (`OggOpus `__). ``sample_rate_hertz`` - must be 16000. - AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE (int): Although the use of lossy encodings is not recommended, if a very - low bitrate encoding is required, ``OGG_OPUS`` is highly preferred over - Speex encoding. The `Speex `__ encoding supported by - Dialogflow API has a header byte in each block, as in MIME type - ``audio/x-speex-with-header-byte``. It is a variant of the RTP Speex - encoding defined in `RFC 5574 `__. - The stream is a sequence of blocks, one block per RTP packet. Each block - starts with a byte containing the length of the block, in bytes, - followed by one or more frames of Speex data, padded to an integral - number of bytes (octets) as specified in RFC 5574. In other words, each - RTP header is replaced with a single byte containing the block length. - Only Speex wideband is supported. ``sample_rate_hertz`` must be 16000. - """ - - AUDIO_ENCODING_UNSPECIFIED = 0 - AUDIO_ENCODING_LINEAR_16 = 1 - AUDIO_ENCODING_FLAC = 2 - AUDIO_ENCODING_MULAW = 3 - AUDIO_ENCODING_AMR = 4 - AUDIO_ENCODING_AMR_WB = 5 - AUDIO_ENCODING_OGG_OPUS = 6 - AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 - - -class IntentView(enum.IntEnum): - """ - Represents the options for views of an intent. - An intent can be a sizable object. Therefore, we provide a resource view that - does not return training phrases in the response by default. - - Attributes: - INTENT_VIEW_UNSPECIFIED (int): Training phrases field is not populated in the response. - INTENT_VIEW_FULL (int): All fields are populated. - """ - - INTENT_VIEW_UNSPECIFIED = 0 - INTENT_VIEW_FULL = 1 - - -class NullValue(enum.IntEnum): - """ - ``NullValue`` is a singleton enumeration to represent the null value - for the ``Value`` type union. - - The JSON representation for ``NullValue`` is JSON ``null``. - - Attributes: - NULL_VALUE (int): Null value. - """ - - NULL_VALUE = 0 - - -class OutputAudioEncoding(enum.IntEnum): - """ - Audio encoding of the output audio format in Text-To-Speech. - - Attributes: - OUTPUT_AUDIO_ENCODING_UNSPECIFIED (int): Not specified. - OUTPUT_AUDIO_ENCODING_LINEAR_16 (int): Uncompressed 16-bit signed little-endian samples (Linear PCM). - Audio content returned as LINEAR16 also contains a WAV header. - OUTPUT_AUDIO_ENCODING_MP3 (int): MP3 audio at 32kbps. - OUTPUT_AUDIO_ENCODING_OGG_OPUS (int): Opus encoded audio wrapped in an ogg container. The result will be a - file which can be played natively on Android, and in browsers (at least - Chrome and Firefox). The quality of the encoding is considerably higher - than MP3 while using approximately the same bitrate. - """ - - OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0 - OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1 - OUTPUT_AUDIO_ENCODING_MP3 = 2 - OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3 - - -class SpeechModelVariant(enum.IntEnum): - """ - Variant of the specified ``Speech model`` to use. - - See the `Cloud Speech - documentation `__ - for which models have different variants. For example, the "phone_call" - model has both a standard and an enhanced variant. When you use an - enhanced model, you will generally receive higher quality results than - for a standard model. - - Attributes: - SPEECH_MODEL_VARIANT_UNSPECIFIED (int): No model variant specified. In this case Dialogflow defaults to - USE_BEST_AVAILABLE. - USE_BEST_AVAILABLE (int): Use the best available variant of the ``Speech model`` that the - caller is eligible for. - - Please see the `Dialogflow - docs `__ for how - to make your project eligible for enhanced models. - USE_STANDARD (int): Use standard model variant even if an enhanced model is available. - See the `Cloud Speech - documentation `__ - for details about enhanced models. - USE_ENHANCED (int): Use an enhanced model variant: - - - If an enhanced variant does not exist for the given ``model`` and - request language, Dialogflow falls back to the standard variant. - - The `Cloud Speech - documentation `__ - describes which models have enhanced variants. - - - If the API caller isn't eligible for enhanced models, Dialogflow - returns an error. Please see the `Dialogflow - docs `__ for - how to make your project eligible. - """ - - SPEECH_MODEL_VARIANT_UNSPECIFIED = 0 - USE_BEST_AVAILABLE = 1 - USE_STANDARD = 2 - USE_ENHANCED = 3 - - -class SsmlVoiceGender(enum.IntEnum): - """ - Gender of the voice as described in `SSML voice - element `__. - - Attributes: - SSML_VOICE_GENDER_UNSPECIFIED (int): An unspecified gender, which means that the client doesn't care which - gender the selected voice will have. - SSML_VOICE_GENDER_MALE (int): A male voice. - SSML_VOICE_GENDER_FEMALE (int): A female voice. - SSML_VOICE_GENDER_NEUTRAL (int): A gender-neutral voice. - """ - - SSML_VOICE_GENDER_UNSPECIFIED = 0 - SSML_VOICE_GENDER_MALE = 1 - SSML_VOICE_GENDER_FEMALE = 2 - SSML_VOICE_GENDER_NEUTRAL = 3 - - -class Agent(object): - class ApiVersion(enum.IntEnum): - """ - API version for the agent. - - Attributes: - API_VERSION_UNSPECIFIED (int): Not specified. - API_VERSION_V1 (int): Legacy V1 API. - API_VERSION_V2 (int): V2 API. - API_VERSION_V2_BETA_1 (int): V2beta1 API. - """ - - API_VERSION_UNSPECIFIED = 0 - API_VERSION_V1 = 1 - API_VERSION_V2 = 2 - API_VERSION_V2_BETA_1 = 3 - - class MatchMode(enum.IntEnum): - """ - Match mode determines how intents are detected from user queries. - - Attributes: - MATCH_MODE_UNSPECIFIED (int): Not specified. - MATCH_MODE_HYBRID (int): Best for agents with a small number of examples in intents and/or wide - use of templates syntax and composite entities. - MATCH_MODE_ML_ONLY (int): Can be used for agents with a large number of examples in intents, - especially the ones using @sys.any or very large custom entities. - """ - - MATCH_MODE_UNSPECIFIED = 0 - MATCH_MODE_HYBRID = 1 - MATCH_MODE_ML_ONLY = 2 - - class Tier(enum.IntEnum): - """ - Represents the agent tier. - - Attributes: - TIER_UNSPECIFIED (int): Not specified. This value should never be used. - TIER_STANDARD (int): Standard tier. - TIER_ENTERPRISE (int): Enterprise tier (Essentials). - TIER_ENTERPRISE_PLUS (int): Enterprise tier (Plus). - """ - - TIER_UNSPECIFIED = 0 - TIER_STANDARD = 1 - TIER_ENTERPRISE = 2 - TIER_ENTERPRISE_PLUS = 3 - - -class Document(object): - class KnowledgeType(enum.IntEnum): - """ - The knowledge type of document content. - - Attributes: - KNOWLEDGE_TYPE_UNSPECIFIED (int): The type is unspecified or arbitrary. - FAQ (int): The document content contains question and answer pairs as either HTML or - CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats - may fail to be parsed. - - CSV must have questions in the first column and answers in the second, - with no header. Because of this explicit format, they are always parsed - accurately. - EXTRACTIVE_QA (int): Documents for which unstructured text is extracted and used for - question answering. - """ - - KNOWLEDGE_TYPE_UNSPECIFIED = 0 - FAQ = 1 - EXTRACTIVE_QA = 2 - - -class EntityType(object): - class AutoExpansionMode(enum.IntEnum): - """ - Represents different entity type expansion modes. Automated expansion - allows an agent to recognize values that have not been explicitly listed in - the entity (for example, new kinds of shopping list items). - - Attributes: - AUTO_EXPANSION_MODE_UNSPECIFIED (int): Auto expansion disabled for the entity. - AUTO_EXPANSION_MODE_DEFAULT (int): Allows an agent to recognize values that have not been explicitly - listed in the entity. - """ - - AUTO_EXPANSION_MODE_UNSPECIFIED = 0 - AUTO_EXPANSION_MODE_DEFAULT = 1 - - class Kind(enum.IntEnum): - """ - Represents kinds of entities. - - Attributes: - KIND_UNSPECIFIED (int): Not specified. This value should be never used. - KIND_MAP (int): Map entity types allow mapping of a group of synonyms to a reference - value. - KIND_LIST (int): List entity types contain a set of entries that do not map to reference - values. However, list entity types can contain references to other entity - types (with or without aliases). - KIND_REGEXP (int): Regexp entity types allow to specify regular expressions in entries - values. - """ - - KIND_UNSPECIFIED = 0 - KIND_MAP = 1 - KIND_LIST = 2 - KIND_REGEXP = 3 - - -class Environment(object): - class State(enum.IntEnum): - """ - Represents an environment state. When an environment is pointed to a - new agent version, the environment is temporarily set to the ``LOADING`` - state. During that time, the environment keeps on serving the previous - version of the agent. After the new agent version is done loading, the - environment is set back to the ``RUNNING`` state. - - Attributes: - STATE_UNSPECIFIED (int): Not specified. This value is not used. - STOPPED (int): Stopped. - LOADING (int): Loading. - RUNNING (int): Running. - """ - - STATE_UNSPECIFIED = 0 - STOPPED = 1 - LOADING = 2 - RUNNING = 3 - - -class Intent(object): - class WebhookState(enum.IntEnum): - """ - Represents the different states that webhooks can be in. - - Attributes: - WEBHOOK_STATE_UNSPECIFIED (int): Webhook is disabled in the agent and in the intent. - WEBHOOK_STATE_ENABLED (int): Webhook is enabled in the agent and in the intent. - WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING (int): Webhook is enabled in the agent and in the intent. Also, each slot - filling prompt is forwarded to the webhook. - """ - - WEBHOOK_STATE_UNSPECIFIED = 0 - WEBHOOK_STATE_ENABLED = 1 - WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2 - - class TrainingPhrase(object): - class Type(enum.IntEnum): - """ - Represents different types of training phrases. - - Attributes: - TYPE_UNSPECIFIED (int): Not specified. This value should never be used. - EXAMPLE (int): Examples do not contain @-prefixed entity type names, but example parts - can be annotated with entity types. - TEMPLATE (int): Templates are not annotated with entity types, but they can contain - @-prefixed entity type names as substrings. - Template mode has been deprecated. Example mode is the only supported - way to create new training phrases. If you have existing training - phrases that you've created in template mode, those will continue to - work. - """ - - TYPE_UNSPECIFIED = 0 - EXAMPLE = 1 - TEMPLATE = 2 - - class Message(object): - class Platform(enum.IntEnum): - """ - Represents different platforms that a rich message can be intended for. - - Attributes: - PLATFORM_UNSPECIFIED (int): Not specified. - FACEBOOK (int): Facebook. - SLACK (int): Slack. - TELEGRAM (int): Telegram. - KIK (int): Kik. - SKYPE (int): Skype. - LINE (int): Line. - VIBER (int): Viber. - ACTIONS_ON_GOOGLE (int): Google Assistant See `Dialogflow webhook - format `__ - TELEPHONY (int): Telephony Gateway. - GOOGLE_HANGOUTS (int): Google Hangouts. - """ - - PLATFORM_UNSPECIFIED = 0 - FACEBOOK = 1 - SLACK = 2 - TELEGRAM = 3 - KIK = 4 - SKYPE = 5 - LINE = 6 - VIBER = 7 - ACTIONS_ON_GOOGLE = 8 - TELEPHONY = 10 - GOOGLE_HANGOUTS = 11 - - class RbmCarouselCard(object): - class CardWidth(enum.IntEnum): - """ - The width of the cards in the carousel. - - Attributes: - CARD_WIDTH_UNSPECIFIED (int): Not specified. - SMALL (int): 120 DP. Note that tall media cannot be used. - MEDIUM (int): 232 DP. - """ - - CARD_WIDTH_UNSPECIFIED = 0 - SMALL = 1 - MEDIUM = 2 - - class RbmStandaloneCard(object): - class CardOrientation(enum.IntEnum): - """ - Orientation of the card. - - Attributes: - CARD_ORIENTATION_UNSPECIFIED (int): Not specified. - HORIZONTAL (int): Horizontal layout. - VERTICAL (int): Vertical layout. - """ - - CARD_ORIENTATION_UNSPECIFIED = 0 - HORIZONTAL = 1 - VERTICAL = 2 - - class ThumbnailImageAlignment(enum.IntEnum): - """ - Thumbnail preview alignment for standalone cards with horizontal - layout. - - Attributes: - THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED (int): Not specified. - LEFT (int): Thumbnail preview is left-aligned. - RIGHT (int): Thumbnail preview is right-aligned. - """ - - THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED = 0 - LEFT = 1 - RIGHT = 2 - - class RbmCardContent(object): - class RbmMedia(object): - class Height(enum.IntEnum): - """ - Media height - - Attributes: - HEIGHT_UNSPECIFIED (int): Not specified. - SHORT (int): 112 DP. - MEDIUM (int): 168 DP. - TALL (int): 264 DP. Not available for rich card carousels when the card width - is set to small. - """ - - HEIGHT_UNSPECIFIED = 0 - SHORT = 1 - MEDIUM = 2 - TALL = 3 - - class MediaContent(object): - class ResponseMediaType(enum.IntEnum): - """ - Format of response media type. - - Attributes: - RESPONSE_MEDIA_TYPE_UNSPECIFIED (int): Unspecified. - AUDIO (int): Response media type is audio. - """ - - RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0 - AUDIO = 1 - - class BrowseCarouselCard(object): - class ImageDisplayOptions(enum.IntEnum): - """ - Image display options for Actions on Google. This should be used for - when the image's aspect ratio does not match the image container's - aspect ratio. - - Attributes: - IMAGE_DISPLAY_OPTIONS_UNSPECIFIED (int): Fill the gaps between the image and the image container with gray - bars. - GRAY (int): Fill the gaps between the image and the image container with gray - bars. - WHITE (int): Fill the gaps between the image and the image container with white - bars. - CROPPED (int): Image is scaled such that the image width and height match or exceed - the container dimensions. This may crop the top and bottom of the - image if the scaled image height is greater than the container - height, or crop the left and right of the image if the scaled image - width is greater than the container width. This is similar to "Zoom - Mode" on a widescreen TV when playing a 4:3 video. - BLURRED_BACKGROUND (int): Pad the gaps between image and image frame with a blurred copy of the - same image. - """ - - IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0 - GRAY = 1 - WHITE = 2 - CROPPED = 3 - BLURRED_BACKGROUND = 4 - - class BrowseCarouselCardItem(object): - class OpenUrlAction(object): - class UrlTypeHint(enum.IntEnum): - """ - Type of the URI. - - Attributes: - URL_TYPE_HINT_UNSPECIFIED (int): Unspecified - AMP_ACTION (int): Url would be an amp action - AMP_CONTENT (int): URL that points directly to AMP content, or to a canonical URL - which refers to AMP content via . - """ - - URL_TYPE_HINT_UNSPECIFIED = 0 - AMP_ACTION = 1 - AMP_CONTENT = 2 - - class ColumnProperties(object): - class HorizontalAlignment(enum.IntEnum): - """ - Text alignments within a cell. - - Attributes: - HORIZONTAL_ALIGNMENT_UNSPECIFIED (int): Text is aligned to the leading edge of the column. - LEADING (int): Text is aligned to the leading edge of the column. - CENTER (int): Text is centered in the column. - TRAILING (int): Text is aligned to the trailing edge of the column. - """ - - HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0 - LEADING = 1 - CENTER = 2 - TRAILING = 3 - - -class KnowledgeAnswers(object): - class Answer(object): - class MatchConfidenceLevel(enum.IntEnum): - """ - Represents the system's confidence that this knowledge answer is a good - match for this conversational query. - - Attributes: - MATCH_CONFIDENCE_LEVEL_UNSPECIFIED (int): Not specified. - LOW (int): Indicates that the confidence is low. - MEDIUM (int): Indicates our confidence is medium. - HIGH (int): Indicates our confidence is high. - """ - - MATCH_CONFIDENCE_LEVEL_UNSPECIFIED = 0 - LOW = 1 - MEDIUM = 2 - HIGH = 3 - - -class KnowledgeOperationMetadata(object): - class State(enum.IntEnum): - """ - States of the operation. - - Attributes: - STATE_UNSPECIFIED (int): State unspecified. - PENDING (int): The operation has been created. - RUNNING (int): The operation is currently running. - DONE (int): The operation is done, either cancelled or completed. - """ - - STATE_UNSPECIFIED = 0 - PENDING = 1 - RUNNING = 2 - DONE = 3 - - -class SessionEntityType(object): - class EntityOverrideMode(enum.IntEnum): - """ - The types of modifications for a session entity type. - - Attributes: - ENTITY_OVERRIDE_MODE_UNSPECIFIED (int): Not specified. This value should be never used. - ENTITY_OVERRIDE_MODE_OVERRIDE (int): The collection of session entities overrides the collection of entities - in the corresponding custom entity type. - ENTITY_OVERRIDE_MODE_SUPPLEMENT (int): The collection of session entities extends the collection of - entities in the corresponding custom entity type. - - Note: Even in this override mode calls to ``ListSessionEntityTypes``, - ``GetSessionEntityType``, ``CreateSessionEntityType`` and - ``UpdateSessionEntityType`` only return the additional entities added in - this session entity type. If you want to get the supplemented list, - please call ``EntityTypes.GetEntityType`` on the custom entity type and - merge. - """ - - ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0 - ENTITY_OVERRIDE_MODE_OVERRIDE = 1 - ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2 - - -class StreamingRecognitionResult(object): - class MessageType(enum.IntEnum): - """ - Type of the response message. - - Attributes: - MESSAGE_TYPE_UNSPECIFIED (int): Not specified. Should never be used. - TRANSCRIPT (int): Message contains a (possibly partial) transcript. - END_OF_SINGLE_UTTERANCE (int): Event indicates that the server has detected the end of the user's - speech utterance and expects no additional speech. Therefore, the server - will not process additional audio (although it may subsequently return - additional results). The client should stop sending additional audio - data, half-close the gRPC connection, and wait for any additional - results until the server closes the gRPC connection. This message is - only sent if ``single_utterance`` was set to ``true``, and is not used - otherwise. - """ - - MESSAGE_TYPE_UNSPECIFIED = 0 - TRANSCRIPT = 1 - END_OF_SINGLE_UTTERANCE = 2 - - -class ValidationError(object): - class Severity(enum.IntEnum): - """ - Represents a level of severity. - - Attributes: - SEVERITY_UNSPECIFIED (int): Not specified. This value should never be used. - INFO (int): The agent doesn't follow Dialogflow best practicies. - WARNING (int): The agent may not behave as expected. - ERROR (int): The agent may experience partial failures. - CRITICAL (int): The agent may completely fail. - """ - - SEVERITY_UNSPECIFIED = 0 - INFO = 1 - WARNING = 2 - ERROR = 3 - CRITICAL = 4 diff --git a/dialogflow_v2beta1/gapic/environments_client.py b/dialogflow_v2beta1/gapic/environments_client.py deleted file mode 100644 index b0f74e725..000000000 --- a/dialogflow_v2beta1/gapic/environments_client.py +++ /dev/null @@ -1,299 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2beta1 Environments API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from dialogflow_v2beta1.gapic import enums -from dialogflow_v2beta1.gapic import environments_client_config -from dialogflow_v2beta1.gapic.transports import environments_grpc_transport -from dialogflow_v2beta1.proto import environment_pb2 -from dialogflow_v2beta1.proto import environment_pb2_grpc - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class EnvironmentsClient(object): - """Service for managing ``Environments``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2beta1.Environments" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2beta1.EnvironmentsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def agent_path(cls, project): - """Return a fully-qualified agent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent", project=project - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.EnvironmentsGrpcTransport, - Callable[[~.Credentials, type], ~.EnvironmentsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = environments_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=environments_grpc_transport.EnvironmentsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = environments_grpc_transport.EnvironmentsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_environments( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all non-draft environments of the specified agent. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.EnvironmentsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # Iterate over all results - >>> for element in client.list_environments(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_environments(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The agent to list all environments from. Format: - - - ``projects//agent`` - - \`projects//locations//agent - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2beta1.types.Environment` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_environments" not in self._inner_api_calls: - self._inner_api_calls[ - "list_environments" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_environments, - default_retry=self._method_configs["ListEnvironments"].retry, - default_timeout=self._method_configs["ListEnvironments"].timeout, - client_info=self._client_info, - ) - - request = environment_pb2.ListEnvironmentsRequest( - parent=parent, page_size=page_size - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_environments"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="environments", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator diff --git a/dialogflow_v2beta1/gapic/environments_client_config.py b/dialogflow_v2beta1/gapic/environments_client_config.py deleted file mode 100644 index c8e084e0c..000000000 --- a/dialogflow_v2beta1/gapic/environments_client_config.py +++ /dev/null @@ -1,67 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2beta1.Environments": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_3_codes": ["UNAVAILABLE"], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 180000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 180000, - "total_timeout_millis": 180000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListEnvironments": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - } - }, - } - } -} diff --git a/dialogflow_v2beta1/gapic/intents_client.py b/dialogflow_v2beta1/gapic/intents_client.py deleted file mode 100644 index 3945b1d78..000000000 --- a/dialogflow_v2beta1/gapic/intents_client.py +++ /dev/null @@ -1,890 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2beta1 Intents API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.operation -import google.api_core.operations_v1 -import google.api_core.page_iterator -import google.api_core.path_template -import google.api_core.protobuf_helpers -import grpc - -from dialogflow_v2beta1.gapic import enums -from dialogflow_v2beta1.gapic import intents_client_config -from dialogflow_v2beta1.gapic.transports import intents_grpc_transport -from dialogflow_v2beta1.proto import agent_pb2 -from dialogflow_v2beta1.proto import agent_pb2_grpc -from dialogflow_v2beta1.proto import context_pb2 -from dialogflow_v2beta1.proto import context_pb2_grpc -from dialogflow_v2beta1.proto import document_pb2 -from dialogflow_v2beta1.proto import document_pb2_grpc -from dialogflow_v2beta1.proto import entity_type_pb2 -from dialogflow_v2beta1.proto import entity_type_pb2_grpc -from dialogflow_v2beta1.proto import environment_pb2 -from dialogflow_v2beta1.proto import environment_pb2_grpc -from dialogflow_v2beta1.proto import gcs_pb2 -from dialogflow_v2beta1.proto import intent_pb2 -from dialogflow_v2beta1.proto import intent_pb2_grpc -from dialogflow_v2beta1.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class IntentsClient(object): - """Service for managing ``Intents``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2beta1.Intents" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2beta1.IntentsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def agent_path(cls, project, agent): - """Return a fully-qualified agent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agents/{agent}", project=project, agent=agent - ) - - @classmethod - def project_agent_path(cls, project): - """Return a fully-qualified project_agent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent", project=project - ) - - @classmethod - def intent_path(cls, project, intent): - """Return a fully-qualified intent string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/intents/{intent}", project=project, intent=intent - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.IntentsGrpcTransport, - Callable[[~.Credentials, type], ~.IntentsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = intents_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=intents_grpc_transport.IntentsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = intents_grpc_transport.IntentsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_intents( - self, - parent, - language_code=None, - intent_view=None, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all intents in the specified agent. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.IntentsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # Iterate over all results - >>> for element in client.list_intents(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_intents(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The agent to list all intents from. Format: - ``projects//agent``. - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - intent_view (~google.cloud.dialogflow_v2beta1.types.IntentView): Optional. The resource view to apply to the returned intent. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2beta1.types.Intent` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_intents" not in self._inner_api_calls: - self._inner_api_calls[ - "list_intents" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_intents, - default_retry=self._method_configs["ListIntents"].retry, - default_timeout=self._method_configs["ListIntents"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.ListIntentsRequest( - parent=parent, - language_code=language_code, - intent_view=intent_view, - page_size=page_size, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_intents"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="intents", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def get_intent( - self, - name, - language_code=None, - intent_view=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified intent. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.IntentsClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> response = client.get_intent(name) - - Args: - name (str): Required. The name of the intent. Format: - ``projects//agent/intents/``. - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - intent_view (~google.cloud.dialogflow_v2beta1.types.IntentView): Optional. The resource view to apply to the returned intent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.Intent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "get_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_intent, - default_retry=self._method_configs["GetIntent"].retry, - default_timeout=self._method_configs["GetIntent"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.GetIntentRequest( - name=name, language_code=language_code, intent_view=intent_view - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_intent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_intent( - self, - parent, - intent, - language_code=None, - intent_view=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates an intent in the specified agent. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.IntentsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `intent`: - >>> intent = {} - >>> - >>> response = client.create_intent(parent, intent) - - Args: - parent (str): Required. The agent to create a intent for. Format: - ``projects//agent``. - intent (Union[dict, ~google.cloud.dialogflow_v2beta1.types.Intent]): Required. The intent to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.Intent` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - intent_view (~google.cloud.dialogflow_v2beta1.types.IntentView): Optional. The resource view to apply to the returned intent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.Intent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "create_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_intent, - default_retry=self._method_configs["CreateIntent"].retry, - default_timeout=self._method_configs["CreateIntent"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.CreateIntentRequest( - parent=parent, - intent=intent, - language_code=language_code, - intent_view=intent_view, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_intent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_intent( - self, - intent, - language_code=None, - update_mask=None, - intent_view=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified intent. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.IntentsClient() - >>> - >>> # TODO: Initialize `intent`: - >>> intent = {} - >>> - >>> response = client.update_intent(intent) - - Args: - intent (Union[dict, ~google.cloud.dialogflow_v2beta1.types.Intent]): Required. The intent to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.Intent` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - update_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - intent_view (~google.cloud.dialogflow_v2beta1.types.IntentView): Optional. The resource view to apply to the returned intent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.Intent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "update_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_intent, - default_retry=self._method_configs["UpdateIntent"].retry, - default_timeout=self._method_configs["UpdateIntent"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.UpdateIntentRequest( - intent=intent, - language_code=language_code, - update_mask=update_mask, - intent_view=intent_view, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("intent.name", intent.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_intent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_intent( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified intent and its direct or indirect followup intents. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.IntentsClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> client.delete_intent(name) - - Args: - name (str): Required. The name of the intent to delete. If this intent has - direct or indirect followup intents, we also delete them. - - Format: ``projects//agent/intents/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_intent, - default_retry=self._method_configs["DeleteIntent"].retry, - default_timeout=self._method_configs["DeleteIntent"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.DeleteIntentRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_intent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def batch_update_intents( - self, - parent, - intent_batch_uri=None, - intent_batch_inline=None, - language_code=None, - update_mask=None, - intent_view=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates/Creates multiple intents in the specified agent. - - Operation - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.IntentsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> response = client.batch_update_intents(parent) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the agent to update or create intents in. - Format: ``projects//agent``. - intent_batch_uri (str): The URI to a Google Cloud Storage file containing intents to update or - create. The file format can either be a serialized proto (of IntentBatch - type) or JSON object. Note: The URI must start with "gs://". - intent_batch_inline (Union[dict, ~google.cloud.dialogflow_v2beta1.types.IntentBatch]): The collection of intents to update or create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.IntentBatch` - language_code (str): Optional. The language used to access language-specific data. If not - specified, the agent's default language is used. For more information, - see `Multilingual intent and entity - data `__. - update_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - intent_view (~google.cloud.dialogflow_v2beta1.types.IntentView): Optional. The resource view to apply to the returned intent. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_update_intents" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_update_intents" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_update_intents, - default_retry=self._method_configs["BatchUpdateIntents"].retry, - default_timeout=self._method_configs["BatchUpdateIntents"].timeout, - client_info=self._client_info, - ) - - # Sanity check: We have some fields which are mutually exclusive; - # raise ValueError if more than one is sent. - google.api_core.protobuf_helpers.check_oneof( - intent_batch_uri=intent_batch_uri, intent_batch_inline=intent_batch_inline - ) - - request = intent_pb2.BatchUpdateIntentsRequest( - parent=parent, - intent_batch_uri=intent_batch_uri, - intent_batch_inline=intent_batch_inline, - language_code=language_code, - update_mask=update_mask, - intent_view=intent_view, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_update_intents"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - intent_pb2.BatchUpdateIntentsResponse, - metadata_type=struct_pb2.Struct, - ) - - def batch_delete_intents( - self, - parent, - intents, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes intents in the specified agent. - - Operation - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.IntentsClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `intents`: - >>> intents = [] - >>> - >>> response = client.batch_delete_intents(parent, intents) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The name of the agent to delete all entities types for. - Format: ``projects//agent``. - intents (list[Union[dict, ~google.cloud.dialogflow_v2beta1.types.Intent]]): Required. The collection of intents to delete. Only intent ``name`` - must be filled in. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.Intent` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_delete_intents" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_delete_intents" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_delete_intents, - default_retry=self._method_configs["BatchDeleteIntents"].retry, - default_timeout=self._method_configs["BatchDeleteIntents"].timeout, - client_info=self._client_info, - ) - - request = intent_pb2.BatchDeleteIntentsRequest(parent=parent, intents=intents) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_delete_intents"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - empty_pb2.Empty, - metadata_type=struct_pb2.Struct, - ) diff --git a/dialogflow_v2beta1/gapic/intents_client_config.py b/dialogflow_v2beta1/gapic/intents_client_config.py deleted file mode 100644 index 7adfd6a6f..000000000 --- a/dialogflow_v2beta1/gapic/intents_client_config.py +++ /dev/null @@ -1,97 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2beta1.Intents": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_3_codes": ["UNAVAILABLE"], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 180000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 180000, - "total_timeout_millis": 180000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListIntents": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetIntent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "CreateIntent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateIntent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteIntent": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchUpdateIntents": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "BatchDeleteIntents": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2beta1/gapic/knowledge_bases_client.py b/dialogflow_v2beta1/gapic/knowledge_bases_client.py deleted file mode 100644 index 1b5abbbbd..000000000 --- a/dialogflow_v2beta1/gapic/knowledge_bases_client.py +++ /dev/null @@ -1,640 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2beta1 KnowledgeBases API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from dialogflow_v2beta1.gapic import enums -from dialogflow_v2beta1.gapic import knowledge_bases_client_config -from dialogflow_v2beta1.gapic.transports import knowledge_bases_grpc_transport -from dialogflow_v2beta1.proto import agent_pb2 -from dialogflow_v2beta1.proto import agent_pb2_grpc -from dialogflow_v2beta1.proto import context_pb2 -from dialogflow_v2beta1.proto import context_pb2_grpc -from dialogflow_v2beta1.proto import document_pb2 -from dialogflow_v2beta1.proto import document_pb2_grpc -from dialogflow_v2beta1.proto import entity_type_pb2 -from dialogflow_v2beta1.proto import entity_type_pb2_grpc -from dialogflow_v2beta1.proto import environment_pb2 -from dialogflow_v2beta1.proto import environment_pb2_grpc -from dialogflow_v2beta1.proto import gcs_pb2 -from dialogflow_v2beta1.proto import intent_pb2 -from dialogflow_v2beta1.proto import intent_pb2_grpc -from dialogflow_v2beta1.proto import knowledge_base_pb2 -from dialogflow_v2beta1.proto import knowledge_base_pb2_grpc -from dialogflow_v2beta1.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class KnowledgeBasesClient(object): - """Service for managing ``KnowledgeBases``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2beta1.KnowledgeBases" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2beta1.KnowledgeBasesClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def knowledge_base_path(cls, project, knowledge_base): - """Return a fully-qualified knowledge_base string.""" - return google.api_core.path_template.expand( - "projects/{project}/knowledgeBases/{knowledge_base}", - project=project, - knowledge_base=knowledge_base, - ) - - @classmethod - def project_path(cls, project): - """Return a fully-qualified project string.""" - return google.api_core.path_template.expand( - "projects/{project}", project=project - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.KnowledgeBasesGrpcTransport, - Callable[[~.Credentials, type], ~.KnowledgeBasesGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = knowledge_bases_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=knowledge_bases_grpc_transport.KnowledgeBasesGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = knowledge_bases_grpc_transport.KnowledgeBasesGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_knowledge_bases( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all knowledge bases of the specified agent. - - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; only - use ``projects.knowledgeBases``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.KnowledgeBasesClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> # Iterate over all results - >>> for element in client.list_knowledge_bases(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_knowledge_bases(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The project to list of knowledge bases for. Format: - ``projects/``. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2beta1.types.KnowledgeBase` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_knowledge_bases" not in self._inner_api_calls: - self._inner_api_calls[ - "list_knowledge_bases" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_knowledge_bases, - default_retry=self._method_configs["ListKnowledgeBases"].retry, - default_timeout=self._method_configs["ListKnowledgeBases"].timeout, - client_info=self._client_info, - ) - - request = knowledge_base_pb2.ListKnowledgeBasesRequest( - parent=parent, page_size=page_size - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_knowledge_bases"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="knowledge_bases", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def get_knowledge_base( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified knowledge base. - - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; only - use ``projects.knowledgeBases``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.KnowledgeBasesClient() - >>> - >>> name = client.knowledge_base_path('[PROJECT]', '[KNOWLEDGE_BASE]') - >>> - >>> response = client.get_knowledge_base(name) - - Args: - name (str): Required. The name of the knowledge base to retrieve. Format - ``projects//knowledgeBases/``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.KnowledgeBase` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_knowledge_base" not in self._inner_api_calls: - self._inner_api_calls[ - "get_knowledge_base" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_knowledge_base, - default_retry=self._method_configs["GetKnowledgeBase"].retry, - default_timeout=self._method_configs["GetKnowledgeBase"].timeout, - client_info=self._client_info, - ) - - request = knowledge_base_pb2.GetKnowledgeBaseRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_knowledge_base"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_knowledge_base( - self, - parent, - knowledge_base, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a knowledge base. - - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; only - use ``projects.knowledgeBases``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.KnowledgeBasesClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> # TODO: Initialize `knowledge_base`: - >>> knowledge_base = {} - >>> - >>> response = client.create_knowledge_base(parent, knowledge_base) - - Args: - parent (str): Required. The project to create a knowledge base for. Format: - ``projects/``. - knowledge_base (Union[dict, ~google.cloud.dialogflow_v2beta1.types.KnowledgeBase]): Required. The knowledge base to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.KnowledgeBase` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.KnowledgeBase` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_knowledge_base" not in self._inner_api_calls: - self._inner_api_calls[ - "create_knowledge_base" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_knowledge_base, - default_retry=self._method_configs["CreateKnowledgeBase"].retry, - default_timeout=self._method_configs["CreateKnowledgeBase"].timeout, - client_info=self._client_info, - ) - - request = knowledge_base_pb2.CreateKnowledgeBaseRequest( - parent=parent, knowledge_base=knowledge_base - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_knowledge_base"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_knowledge_base( - self, - name, - force=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified knowledge base. - - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; only - use ``projects.knowledgeBases``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.KnowledgeBasesClient() - >>> - >>> name = client.knowledge_base_path('[PROJECT]', '[KNOWLEDGE_BASE]') - >>> - >>> client.delete_knowledge_base(name) - - Args: - name (str): Required. The name of the knowledge base to delete. Format: - ``projects//knowledgeBases/``. - force (bool): Optional. Force deletes the knowledge base. When set to true, any documents - in the knowledge base are also deleted. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_knowledge_base" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_knowledge_base" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_knowledge_base, - default_retry=self._method_configs["DeleteKnowledgeBase"].retry, - default_timeout=self._method_configs["DeleteKnowledgeBase"].timeout, - client_info=self._client_info, - ) - - request = knowledge_base_pb2.DeleteKnowledgeBaseRequest(name=name, force=force) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_knowledge_base"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_knowledge_base( - self, - knowledge_base, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified knowledge base. - - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; only - use ``projects.knowledgeBases``. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.KnowledgeBasesClient() - >>> - >>> # TODO: Initialize `knowledge_base`: - >>> knowledge_base = {} - >>> - >>> response = client.update_knowledge_base(knowledge_base) - - Args: - knowledge_base (Union[dict, ~google.cloud.dialogflow_v2beta1.types.KnowledgeBase]): Required. The knowledge base to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.KnowledgeBase` - update_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Optional. Not specified means ``update all``. Currently, only - ``display_name`` can be updated, an InvalidArgument will be returned for - attempting to update other fields. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.KnowledgeBase` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_knowledge_base" not in self._inner_api_calls: - self._inner_api_calls[ - "update_knowledge_base" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_knowledge_base, - default_retry=self._method_configs["UpdateKnowledgeBase"].retry, - default_timeout=self._method_configs["UpdateKnowledgeBase"].timeout, - client_info=self._client_info, - ) - - request = knowledge_base_pb2.UpdateKnowledgeBaseRequest( - knowledge_base=knowledge_base, update_mask=update_mask - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("knowledge_base.name", knowledge_base.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_knowledge_base"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/dialogflow_v2beta1/gapic/knowledge_bases_client_config.py b/dialogflow_v2beta1/gapic/knowledge_bases_client_config.py deleted file mode 100644 index 15e8042c4..000000000 --- a/dialogflow_v2beta1/gapic/knowledge_bases_client_config.py +++ /dev/null @@ -1,87 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2beta1.KnowledgeBases": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_3_codes": ["UNAVAILABLE"], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 180000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 180000, - "total_timeout_millis": 180000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListKnowledgeBases": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "CreateKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateKnowledgeBase": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2beta1/gapic/session_entity_types_client.py b/dialogflow_v2beta1/gapic/session_entity_types_client.py deleted file mode 100644 index eb10a3dd6..000000000 --- a/dialogflow_v2beta1/gapic/session_entity_types_client.py +++ /dev/null @@ -1,695 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2beta1 SessionEntityTypes API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from dialogflow_v2beta1.gapic import enums -from dialogflow_v2beta1.gapic import session_entity_types_client_config -from dialogflow_v2beta1.gapic.transports import session_entity_types_grpc_transport -from dialogflow_v2beta1.proto import agent_pb2 -from dialogflow_v2beta1.proto import agent_pb2_grpc -from dialogflow_v2beta1.proto import context_pb2 -from dialogflow_v2beta1.proto import context_pb2_grpc -from dialogflow_v2beta1.proto import document_pb2 -from dialogflow_v2beta1.proto import document_pb2_grpc -from dialogflow_v2beta1.proto import entity_type_pb2 -from dialogflow_v2beta1.proto import entity_type_pb2_grpc -from dialogflow_v2beta1.proto import environment_pb2 -from dialogflow_v2beta1.proto import environment_pb2_grpc -from dialogflow_v2beta1.proto import gcs_pb2 -from dialogflow_v2beta1.proto import intent_pb2 -from dialogflow_v2beta1.proto import intent_pb2_grpc -from dialogflow_v2beta1.proto import knowledge_base_pb2 -from dialogflow_v2beta1.proto import knowledge_base_pb2_grpc -from dialogflow_v2beta1.proto import session_entity_type_pb2 -from dialogflow_v2beta1.proto import session_entity_type_pb2_grpc -from dialogflow_v2beta1.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class SessionEntityTypesClient(object): - """Service for managing ``SessionEntityTypes``.""" - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2beta1.SessionEntityTypes" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2beta1.SessionEntityTypesClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def environment_session_path(cls, project, environment, user, session): - """Return a fully-qualified environment_session string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}", - project=project, - environment=environment, - user=user, - session=session, - ) - - @classmethod - def environment_session_entity_type_path( - cls, project, environment, user, session, entity_type - ): - """Return a fully-qualified environment_session_entity_type string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}", - project=project, - environment=environment, - user=user, - session=session, - entity_type=entity_type, - ) - - @classmethod - def session_path(cls, project, session): - """Return a fully-qualified session string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/sessions/{session}", - project=project, - session=session, - ) - - @classmethod - def session_entity_type_path(cls, project, session, entity_type): - """Return a fully-qualified session_entity_type string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}", - project=project, - session=session, - entity_type=entity_type, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.SessionEntityTypesGrpcTransport, - Callable[[~.Credentials, type], ~.SessionEntityTypesGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = session_entity_types_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=session_entity_types_grpc_transport.SessionEntityTypesGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = session_entity_types_grpc_transport.SessionEntityTypesGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_session_entity_types( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns the list of all session entity types in the specified session. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.SessionEntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # Iterate over all results - >>> for element in client.list_session_entity_types(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_session_entity_types(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The session to list all session entity types from. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users// sessions/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.dialogflow_v2beta1.types.SessionEntityType` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_session_entity_types" not in self._inner_api_calls: - self._inner_api_calls[ - "list_session_entity_types" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_session_entity_types, - default_retry=self._method_configs["ListSessionEntityTypes"].retry, - default_timeout=self._method_configs["ListSessionEntityTypes"].timeout, - client_info=self._client_info, - ) - - request = session_entity_type_pb2.ListSessionEntityTypesRequest( - parent=parent, page_size=page_size - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_session_entity_types"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="session_entity_types", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def get_session_entity_type( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.SessionEntityTypesClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> response = client.get_session_entity_type(name) - - Args: - name (str): Required. The name of the session entity type. Format: - ``projects//agent/sessions//entityTypes/`` - or - ``projects//agent/environments//users//sessions//entityTypes/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.SessionEntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_session_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "get_session_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_session_entity_type, - default_retry=self._method_configs["GetSessionEntityType"].retry, - default_timeout=self._method_configs["GetSessionEntityType"].timeout, - client_info=self._client_info, - ) - - request = session_entity_type_pb2.GetSessionEntityTypeRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_session_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_session_entity_type( - self, - parent, - session_entity_type, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a session entity type. - - If the specified session entity type already exists, overrides the - session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.SessionEntityTypesClient() - >>> - >>> # TODO: Initialize `parent`: - >>> parent = '' - >>> - >>> # TODO: Initialize `session_entity_type`: - >>> session_entity_type = {} - >>> - >>> response = client.create_session_entity_type(parent, session_entity_type) - - Args: - parent (str): Required. The session to create a session entity type for. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users// sessions/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - session_entity_type (Union[dict, ~google.cloud.dialogflow_v2beta1.types.SessionEntityType]): Required. The session entity type to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.SessionEntityType` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.SessionEntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_session_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "create_session_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_session_entity_type, - default_retry=self._method_configs["CreateSessionEntityType"].retry, - default_timeout=self._method_configs["CreateSessionEntityType"].timeout, - client_info=self._client_info, - ) - - request = session_entity_type_pb2.CreateSessionEntityTypeRequest( - parent=parent, session_entity_type=session_entity_type - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_session_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_session_entity_type( - self, - session_entity_type, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.SessionEntityTypesClient() - >>> - >>> # TODO: Initialize `session_entity_type`: - >>> session_entity_type = {} - >>> - >>> response = client.update_session_entity_type(session_entity_type) - - Args: - session_entity_type (Union[dict, ~google.cloud.dialogflow_v2beta1.types.SessionEntityType]): Required. The session entity type to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.SessionEntityType` - update_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Optional. The mask to control which fields get updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.SessionEntityType` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_session_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "update_session_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_session_entity_type, - default_retry=self._method_configs["UpdateSessionEntityType"].retry, - default_timeout=self._method_configs["UpdateSessionEntityType"].timeout, - client_info=self._client_info, - ) - - request = session_entity_type_pb2.UpdateSessionEntityTypeRequest( - session_entity_type=session_entity_type, update_mask=update_mask - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("session_entity_type.name", session_entity_type.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_session_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_session_entity_type( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.SessionEntityTypesClient() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> client.delete_session_entity_type(name) - - Args: - name (str): Required. The name of the entity type to delete. Format: - ``projects//agent/sessions//entityTypes/`` - or - ``projects//agent/environments//users//sessions//entityTypes/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we assume default '-' - user. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_session_entity_type" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_session_entity_type" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_session_entity_type, - default_retry=self._method_configs["DeleteSessionEntityType"].retry, - default_timeout=self._method_configs["DeleteSessionEntityType"].timeout, - client_info=self._client_info, - ) - - request = session_entity_type_pb2.DeleteSessionEntityTypeRequest(name=name) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_session_entity_type"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/dialogflow_v2beta1/gapic/session_entity_types_client_config.py b/dialogflow_v2beta1/gapic/session_entity_types_client_config.py deleted file mode 100644 index ad2f36087..000000000 --- a/dialogflow_v2beta1/gapic/session_entity_types_client_config.py +++ /dev/null @@ -1,87 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2beta1.SessionEntityTypes": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_3_codes": ["UNAVAILABLE"], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 180000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 180000, - "total_timeout_millis": 180000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "ListSessionEntityTypes": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "GetSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "CreateSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "DeleteSessionEntityType": { - "timeout_millis": 60000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2beta1/gapic/sessions_client.py b/dialogflow_v2beta1/gapic/sessions_client.py deleted file mode 100644 index b2077c6da..000000000 --- a/dialogflow_v2beta1/gapic/sessions_client.py +++ /dev/null @@ -1,429 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -"""Accesses the google.cloud.dialogflow.v2beta1 Sessions API.""" - -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.path_template -import grpc - -from dialogflow_v2beta1.gapic import enums -from dialogflow_v2beta1.gapic import sessions_client_config -from dialogflow_v2beta1.gapic.transports import sessions_grpc_transport -from dialogflow_v2beta1.proto import agent_pb2 -from dialogflow_v2beta1.proto import agent_pb2_grpc -from dialogflow_v2beta1.proto import audio_config_pb2 -from dialogflow_v2beta1.proto import context_pb2 -from dialogflow_v2beta1.proto import context_pb2_grpc -from dialogflow_v2beta1.proto import document_pb2 -from dialogflow_v2beta1.proto import document_pb2_grpc -from dialogflow_v2beta1.proto import entity_type_pb2 -from dialogflow_v2beta1.proto import entity_type_pb2_grpc -from dialogflow_v2beta1.proto import environment_pb2 -from dialogflow_v2beta1.proto import environment_pb2_grpc -from dialogflow_v2beta1.proto import gcs_pb2 -from dialogflow_v2beta1.proto import intent_pb2 -from dialogflow_v2beta1.proto import intent_pb2_grpc -from dialogflow_v2beta1.proto import knowledge_base_pb2 -from dialogflow_v2beta1.proto import knowledge_base_pb2_grpc -from dialogflow_v2beta1.proto import session_entity_type_pb2 -from dialogflow_v2beta1.proto import session_entity_type_pb2_grpc -from dialogflow_v2beta1.proto import session_pb2 -from dialogflow_v2beta1.proto import session_pb2_grpc -from dialogflow_v2beta1.proto import validation_result_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("dialogflow").version - - -class SessionsClient(object): - """ - A service used for session interactions. - - For more information, see the `API interactions - guide `__. - """ - - SERVICE_ADDRESS = "dialogflow.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.dialogflow.v2beta1.Sessions" - - @classmethod - def from_service_account_file(cls, filename, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - dialogflow_v2beta1.SessionsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def environment_session_path(cls, project, environment, user, session): - """Return a fully-qualified environment_session string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}", - project=project, - environment=environment, - user=user, - session=session, - ) - - @classmethod - def session_path(cls, project, session): - """Return a fully-qualified session string.""" - return google.api_core.path_template.expand( - "projects/{project}/agent/sessions/{session}", - project=project, - session=session, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.SessionsGrpcTransport, - Callable[[~.Credentials, type], ~.SessionsGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = sessions_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=sessions_grpc_transport.SessionsGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = sessions_grpc_transport.SessionsGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def detect_intent( - self, - session, - query_input, - query_params=None, - output_audio_config=None, - output_audio_config_mask=None, - input_audio=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Processes a natural language query and returns structured, actionable data - as a result. This method is not idempotent, because it may cause contexts - and session entity types to be updated, which in turn might affect - results of future queries. - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.SessionsClient() - >>> - >>> # TODO: Initialize `session`: - >>> session = '' - >>> - >>> # TODO: Initialize `query_input`: - >>> query_input = {} - >>> - >>> response = client.detect_intent(session, query_input) - - Args: - session (str): Required. The name of the session this query is sent to. Format: - ``projects//agent/sessions/``, or - ``projects//agent/environments//users//sessions/``. - If ``Environment ID`` is not specified, we assume default 'draft' - environment. If ``User ID`` is not specified, we are using "-". It's up - to the API caller to choose an appropriate ``Session ID`` and - ``User Id``. They can be a random number or some type of user and - session identifiers (preferably hashed). The length of the - ``Session ID`` and ``User ID`` must not exceed 36 characters. - - For more information, see the `API interactions - guide `__. - query_input (Union[dict, ~google.cloud.dialogflow_v2beta1.types.QueryInput]): Required. The input specification. It can be set to: - - 1. an audio config - which instructs the speech recognizer how to process the speech audio, - - 2. a conversational query in the form of text, or - - 3. an event that specifies which intent to trigger. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.QueryInput` - query_params (Union[dict, ~google.cloud.dialogflow_v2beta1.types.QueryParameters]): The parameters of this query. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.QueryParameters` - output_audio_config (Union[dict, ~google.cloud.dialogflow_v2beta1.types.OutputAudioConfig]): Instructs the speech synthesizer how to generate the output - audio. If this field is not set and agent-level speech synthesizer is not - configured, no output audio is generated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.OutputAudioConfig` - output_audio_config_mask (Union[dict, ~google.cloud.dialogflow_v2beta1.types.FieldMask]): Mask for ``output_audio_config`` indicating which settings in this - request-level config should override speech synthesizer settings defined - at agent-level. - - If unspecified or empty, ``output_audio_config`` replaces the - agent-level config in its entirety. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.dialogflow_v2beta1.types.FieldMask` - input_audio (bytes): The natural language speech audio to be processed. This field should - be populated iff ``query_input`` is set to an input audio config. A - single request can contain up to 1 minute of speech audio data. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.dialogflow_v2beta1.types.DetectIntentResponse` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "detect_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "detect_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.detect_intent, - default_retry=self._method_configs["DetectIntent"].retry, - default_timeout=self._method_configs["DetectIntent"].timeout, - client_info=self._client_info, - ) - - request = session_pb2.DetectIntentRequest( - session=session, - query_input=query_input, - query_params=query_params, - output_audio_config=output_audio_config, - output_audio_config_mask=output_audio_config_mask, - input_audio=input_audio, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("session", session)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["detect_intent"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def streaming_detect_intent( - self, - requests, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Processes a natural language query in audio format in a streaming fashion - and returns structured, actionable data as a result. This method is only - available via the gRPC API (not REST). - - Example: - >>> import dialogflow_v2beta1 - >>> - >>> client = dialogflow_v2beta1.SessionsClient() - >>> - >>> # TODO: Initialize `session`: - >>> session = '' - >>> - >>> # TODO: Initialize `query_input`: - >>> query_input = {} - >>> request = {'session': session, 'query_input': query_input} - >>> - >>> requests = [request] - >>> for element in client.streaming_detect_intent(requests): - ... # process element - ... pass - - Args: - requests (iterator[dict|google.cloud.dialogflow_v2beta1.proto.session_pb2.StreamingDetectIntentRequest]): The input objects. If a dict is provided, it must be of the - same form as the protobuf message :class:`~google.cloud.dialogflow_v2beta1.types.StreamingDetectIntentRequest` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - Iterable[~google.cloud.dialogflow_v2beta1.types.StreamingDetectIntentResponse]. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "streaming_detect_intent" not in self._inner_api_calls: - self._inner_api_calls[ - "streaming_detect_intent" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.streaming_detect_intent, - default_retry=self._method_configs["StreamingDetectIntent"].retry, - default_timeout=self._method_configs["StreamingDetectIntent"].timeout, - client_info=self._client_info, - ) - - return self._inner_api_calls["streaming_detect_intent"]( - requests, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/dialogflow_v2beta1/gapic/sessions_client_config.py b/dialogflow_v2beta1/gapic/sessions_client_config.py deleted file mode 100644 index 465f6423c..000000000 --- a/dialogflow_v2beta1/gapic/sessions_client_config.py +++ /dev/null @@ -1,72 +0,0 @@ -config = { - "interfaces": { - "google.cloud.dialogflow.v2beta1.Sessions": { - "retry_codes": { - "retry_policy_1_codes": ["UNAVAILABLE"], - "no_retry_codes": [], - "retry_policy_3_codes": ["UNAVAILABLE"], - "retry_policy_2_codes": ["UNAVAILABLE"], - "no_retry_1_codes": [], - }, - "retry_params": { - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 60000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 180000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 180000, - "total_timeout_millis": 180000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 220000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 220000, - "total_timeout_millis": 220000, - }, - }, - "methods": { - "DetectIntent": { - "timeout_millis": 220000, - "retry_codes_name": "retry_policy_3_codes", - "retry_params_name": "retry_policy_3_params", - }, - "StreamingDetectIntent": { - "timeout_millis": 220000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params", - }, - }, - } - } -} diff --git a/dialogflow_v2beta1/gapic/transports/__init__.py b/dialogflow_v2beta1/gapic/transports/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/dialogflow_v2beta1/gapic/transports/agents_grpc_transport.py b/dialogflow_v2beta1/gapic/transports/agents_grpc_transport.py deleted file mode 100644 index a9524916b..000000000 --- a/dialogflow_v2beta1/gapic/transports/agents_grpc_transport.py +++ /dev/null @@ -1,266 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers -import google.api_core.operations_v1 - -from dialogflow_v2beta1.proto import agent_pb2_grpc - - -class AgentsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2beta1 Agents API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = {"agents_stub": agent_pb2_grpc.AgentsStub(channel)} - - # Because this API includes a method that returns a - # long-running operation (proto: google.longrunning.Operation), - # instantiate an LRO client. - self._operations_client = google.api_core.operations_v1.OperationsClient( - channel - ) - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def get_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.get_agent`. - - Retrieves the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].GetAgent - - @property - def set_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.set_agent`. - - Creates/updates the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].SetAgent - - @property - def delete_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.delete_agent`. - - Deletes the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].DeleteAgent - - @property - def search_agents(self): - """Return the gRPC stub for :meth:`AgentsClient.search_agents`. - - Returns the list of agents. Since there is at most one - conversational agent per project, this method is useful primarily for - listing all agents across projects the caller has access to. One can - achieve that with a wildcard project collection id "-". Refer to `List - Sub-Collections `__. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].SearchAgents - - @property - def train_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.train_agent`. - - Trains the specified agent. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].TrainAgent - - @property - def export_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.export_agent`. - - Exports the specified agent to a ZIP file. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].ExportAgent - - @property - def import_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.import_agent`. - - Imports the specified agent from a ZIP file. - - Uploads new intents and entity types without deleting the existing ones. - Intents and entity types with the same name are replaced with the new - versions from ``ImportAgentRequest``. After the import, the imported - draft agent will be trained automatically (unless disabled in agent - settings). However, once the import is done, training may not be - completed yet. Please call ``TrainAgent`` and wait for the operation it - returns in order to train explicitly. - - Operation An operation which - tracks when importing is complete. It only tracks when the draft agent - is updated not when it is done training. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].ImportAgent - - @property - def restore_agent(self): - """Return the gRPC stub for :meth:`AgentsClient.restore_agent`. - - Restores the specified agent from a ZIP file. - - Replaces the current agent version with a new one. All the intents and - entity types in the older version are deleted. After the restore, the - restored draft agent will be trained automatically (unless disabled in - agent settings). However, once the restore is done, training may not be - completed yet. Please call ``TrainAgent`` and wait for the operation it - returns in order to train explicitly. - - Operation An operation which - tracks when restoring is complete. It only tracks when the draft agent - is updated not when it is done training. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].RestoreAgent - - @property - def get_validation_result(self): - """Return the gRPC stub for :meth:`AgentsClient.get_validation_result`. - - Gets agent validation result. Agent validation is performed during - training time and is updated automatically when training is completed. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["agents_stub"].GetValidationResult diff --git a/dialogflow_v2beta1/gapic/transports/contexts_grpc_transport.py b/dialogflow_v2beta1/gapic/transports/contexts_grpc_transport.py deleted file mode 100644 index 0bb468b21..000000000 --- a/dialogflow_v2beta1/gapic/transports/contexts_grpc_transport.py +++ /dev/null @@ -1,189 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from dialogflow_v2beta1.proto import context_pb2_grpc - - -class ContextsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2beta1 Contexts API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = {"contexts_stub": context_pb2_grpc.ContextsStub(channel)} - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_contexts(self): - """Return the gRPC stub for :meth:`ContextsClient.list_contexts`. - - Returns the list of all contexts in the specified session. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].ListContexts - - @property - def get_context(self): - """Return the gRPC stub for :meth:`ContextsClient.get_context`. - - Retrieves the specified context. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].GetContext - - @property - def create_context(self): - """Return the gRPC stub for :meth:`ContextsClient.create_context`. - - Creates a context. - - If the specified context already exists, overrides the context. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].CreateContext - - @property - def update_context(self): - """Return the gRPC stub for :meth:`ContextsClient.update_context`. - - Updates the specified context. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].UpdateContext - - @property - def delete_context(self): - """Return the gRPC stub for :meth:`ContextsClient.delete_context`. - - Deletes the specified context. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].DeleteContext - - @property - def delete_all_contexts(self): - """Return the gRPC stub for :meth:`ContextsClient.delete_all_contexts`. - - Deletes all active contexts in the specified session. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["contexts_stub"].DeleteAllContexts diff --git a/dialogflow_v2beta1/gapic/transports/documents_grpc_transport.py b/dialogflow_v2beta1/gapic/transports/documents_grpc_transport.py deleted file mode 100644 index d83dd37b8..000000000 --- a/dialogflow_v2beta1/gapic/transports/documents_grpc_transport.py +++ /dev/null @@ -1,217 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers -import google.api_core.operations_v1 - -from dialogflow_v2beta1.proto import document_pb2_grpc - - -class DocumentsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2beta1 Documents API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = {"documents_stub": document_pb2_grpc.DocumentsStub(channel)} - - # Because this API includes a method that returns a - # long-running operation (proto: google.longrunning.Operation), - # instantiate an LRO client. - self._operations_client = google.api_core.operations_v1.OperationsClient( - channel - ) - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_documents(self): - """Return the gRPC stub for :meth:`DocumentsClient.list_documents`. - - Returns the list of all documents of the knowledge base. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["documents_stub"].ListDocuments - - @property - def get_document(self): - """Return the gRPC stub for :meth:`DocumentsClient.get_document`. - - Retrieves the specified document. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["documents_stub"].GetDocument - - @property - def create_document(self): - """Return the gRPC stub for :meth:`DocumentsClient.create_document`. - - Creates a new document. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["documents_stub"].CreateDocument - - @property - def delete_document(self): - """Return the gRPC stub for :meth:`DocumentsClient.delete_document`. - - Deletes the specified document. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["documents_stub"].DeleteDocument - - @property - def update_document(self): - """Return the gRPC stub for :meth:`DocumentsClient.update_document`. - - Updates the specified document. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["documents_stub"].UpdateDocument - - @property - def reload_document(self): - """Return the gRPC stub for :meth:`DocumentsClient.reload_document`. - - Reloads the specified document from its specified source, - content_uri or content. The previously loaded content of the document - will be deleted. Note: Even when the content of the document has not - changed, there still may be side effects because of internal - implementation changes. - - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["documents_stub"].ReloadDocument diff --git a/dialogflow_v2beta1/gapic/transports/entity_types_grpc_transport.py b/dialogflow_v2beta1/gapic/transports/entity_types_grpc_transport.py deleted file mode 100644 index 8a0ef7744..000000000 --- a/dialogflow_v2beta1/gapic/transports/entity_types_grpc_transport.py +++ /dev/null @@ -1,259 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers -import google.api_core.operations_v1 - -from dialogflow_v2beta1.proto import entity_type_pb2_grpc - - -class EntityTypesGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2beta1 EntityTypes API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "entity_types_stub": entity_type_pb2_grpc.EntityTypesStub(channel) - } - - # Because this API includes a method that returns a - # long-running operation (proto: google.longrunning.Operation), - # instantiate an LRO client. - self._operations_client = google.api_core.operations_v1.OperationsClient( - channel - ) - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_entity_types(self): - """Return the gRPC stub for :meth:`EntityTypesClient.list_entity_types`. - - Returns the list of all entity types in the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].ListEntityTypes - - @property - def get_entity_type(self): - """Return the gRPC stub for :meth:`EntityTypesClient.get_entity_type`. - - Retrieves the specified entity type. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].GetEntityType - - @property - def create_entity_type(self): - """Return the gRPC stub for :meth:`EntityTypesClient.create_entity_type`. - - Creates an entity type in the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].CreateEntityType - - @property - def update_entity_type(self): - """Return the gRPC stub for :meth:`EntityTypesClient.update_entity_type`. - - Updates the specified entity type. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].UpdateEntityType - - @property - def delete_entity_type(self): - """Return the gRPC stub for :meth:`EntityTypesClient.delete_entity_type`. - - Deletes the specified entity type. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].DeleteEntityType - - @property - def batch_update_entity_types(self): - """Return the gRPC stub for :meth:`EntityTypesClient.batch_update_entity_types`. - - Updates/Creates multiple entity types in the specified agent. - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].BatchUpdateEntityTypes - - @property - def batch_delete_entity_types(self): - """Return the gRPC stub for :meth:`EntityTypesClient.batch_delete_entity_types`. - - Deletes entity types in the specified agent. Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].BatchDeleteEntityTypes - - @property - def batch_create_entities(self): - """Return the gRPC stub for :meth:`EntityTypesClient.batch_create_entities`. - - Creates multiple new entities in the specified entity type. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].BatchCreateEntities - - @property - def batch_update_entities(self): - """Return the gRPC stub for :meth:`EntityTypesClient.batch_update_entities`. - - Updates or creates multiple entities in the specified entity type. - This method does not affect entities in the entity type that aren't - explicitly specified in the request. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].BatchUpdateEntities - - @property - def batch_delete_entities(self): - """Return the gRPC stub for :meth:`EntityTypesClient.batch_delete_entities`. - - Deletes entities in the specified entity type. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["entity_types_stub"].BatchDeleteEntities diff --git a/dialogflow_v2beta1/gapic/transports/environments_grpc_transport.py b/dialogflow_v2beta1/gapic/transports/environments_grpc_transport.py deleted file mode 100644 index e8d9ca4ad..000000000 --- a/dialogflow_v2beta1/gapic/transports/environments_grpc_transport.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from dialogflow_v2beta1.proto import environment_pb2_grpc - - -class EnvironmentsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2beta1 Environments API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "environments_stub": environment_pb2_grpc.EnvironmentsStub(channel) - } - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_environments(self): - """Return the gRPC stub for :meth:`EnvironmentsClient.list_environments`. - - Returns the list of all non-draft environments of the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["environments_stub"].ListEnvironments diff --git a/dialogflow_v2beta1/gapic/transports/intents_grpc_transport.py b/dialogflow_v2beta1/gapic/transports/intents_grpc_transport.py deleted file mode 100644 index c5dfceb27..000000000 --- a/dialogflow_v2beta1/gapic/transports/intents_grpc_transport.py +++ /dev/null @@ -1,212 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers -import google.api_core.operations_v1 - -from dialogflow_v2beta1.proto import intent_pb2_grpc - - -class IntentsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2beta1 Intents API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = {"intents_stub": intent_pb2_grpc.IntentsStub(channel)} - - # Because this API includes a method that returns a - # long-running operation (proto: google.longrunning.Operation), - # instantiate an LRO client. - self._operations_client = google.api_core.operations_v1.OperationsClient( - channel - ) - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_intents(self): - """Return the gRPC stub for :meth:`IntentsClient.list_intents`. - - Returns the list of all intents in the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].ListIntents - - @property - def get_intent(self): - """Return the gRPC stub for :meth:`IntentsClient.get_intent`. - - Retrieves the specified intent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].GetIntent - - @property - def create_intent(self): - """Return the gRPC stub for :meth:`IntentsClient.create_intent`. - - Creates an intent in the specified agent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].CreateIntent - - @property - def update_intent(self): - """Return the gRPC stub for :meth:`IntentsClient.update_intent`. - - Updates the specified intent. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].UpdateIntent - - @property - def delete_intent(self): - """Return the gRPC stub for :meth:`IntentsClient.delete_intent`. - - Deletes the specified intent and its direct or indirect followup intents. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].DeleteIntent - - @property - def batch_update_intents(self): - """Return the gRPC stub for :meth:`IntentsClient.batch_update_intents`. - - Updates/Creates multiple intents in the specified agent. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].BatchUpdateIntents - - @property - def batch_delete_intents(self): - """Return the gRPC stub for :meth:`IntentsClient.batch_delete_intents`. - - Deletes intents in the specified agent. - - Operation - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["intents_stub"].BatchDeleteIntents diff --git a/dialogflow_v2beta1/gapic/transports/knowledge_bases_grpc_transport.py b/dialogflow_v2beta1/gapic/transports/knowledge_bases_grpc_transport.py deleted file mode 100644 index 9308c8a2e..000000000 --- a/dialogflow_v2beta1/gapic/transports/knowledge_bases_grpc_transport.py +++ /dev/null @@ -1,191 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from dialogflow_v2beta1.proto import knowledge_base_pb2_grpc - - -class KnowledgeBasesGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2beta1 KnowledgeBases API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "knowledge_bases_stub": knowledge_base_pb2_grpc.KnowledgeBasesStub(channel) - } - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_knowledge_bases(self): - """Return the gRPC stub for :meth:`KnowledgeBasesClient.list_knowledge_bases`. - - Returns the list of all knowledge bases of the specified agent. - - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; only - use ``projects.knowledgeBases``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["knowledge_bases_stub"].ListKnowledgeBases - - @property - def get_knowledge_base(self): - """Return the gRPC stub for :meth:`KnowledgeBasesClient.get_knowledge_base`. - - Retrieves the specified knowledge base. - - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; only - use ``projects.knowledgeBases``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["knowledge_bases_stub"].GetKnowledgeBase - - @property - def create_knowledge_base(self): - """Return the gRPC stub for :meth:`KnowledgeBasesClient.create_knowledge_base`. - - Creates a knowledge base. - - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; only - use ``projects.knowledgeBases``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["knowledge_bases_stub"].CreateKnowledgeBase - - @property - def delete_knowledge_base(self): - """Return the gRPC stub for :meth:`KnowledgeBasesClient.delete_knowledge_base`. - - Deletes the specified knowledge base. - - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; only - use ``projects.knowledgeBases``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["knowledge_bases_stub"].DeleteKnowledgeBase - - @property - def update_knowledge_base(self): - """Return the gRPC stub for :meth:`KnowledgeBasesClient.update_knowledge_base`. - - Updates the specified knowledge base. - - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; only - use ``projects.knowledgeBases``. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["knowledge_bases_stub"].UpdateKnowledgeBase diff --git a/dialogflow_v2beta1/gapic/transports/session_entity_types_grpc_transport.py b/dialogflow_v2beta1/gapic/transports/session_entity_types_grpc_transport.py deleted file mode 100644 index 01a1b8004..000000000 --- a/dialogflow_v2beta1/gapic/transports/session_entity_types_grpc_transport.py +++ /dev/null @@ -1,201 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from dialogflow_v2beta1.proto import session_entity_type_pb2_grpc - - -class SessionEntityTypesGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2beta1 SessionEntityTypes API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "session_entity_types_stub": session_entity_type_pb2_grpc.SessionEntityTypesStub( - channel - ) - } - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_session_entity_types(self): - """Return the gRPC stub for :meth:`SessionEntityTypesClient.list_session_entity_types`. - - Returns the list of all session entity types in the specified session. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["session_entity_types_stub"].ListSessionEntityTypes - - @property - def get_session_entity_type(self): - """Return the gRPC stub for :meth:`SessionEntityTypesClient.get_session_entity_type`. - - Retrieves the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["session_entity_types_stub"].GetSessionEntityType - - @property - def create_session_entity_type(self): - """Return the gRPC stub for :meth:`SessionEntityTypesClient.create_session_entity_type`. - - Creates a session entity type. - - If the specified session entity type already exists, overrides the - session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["session_entity_types_stub"].CreateSessionEntityType - - @property - def update_session_entity_type(self): - """Return the gRPC stub for :meth:`SessionEntityTypesClient.update_session_entity_type`. - - Updates the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["session_entity_types_stub"].UpdateSessionEntityType - - @property - def delete_session_entity_type(self): - """Return the gRPC stub for :meth:`SessionEntityTypesClient.delete_session_entity_type`. - - Deletes the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["session_entity_types_stub"].DeleteSessionEntityType diff --git a/dialogflow_v2beta1/gapic/transports/sessions_grpc_transport.py b/dialogflow_v2beta1/gapic/transports/sessions_grpc_transport.py deleted file mode 100644 index 633becb2b..000000000 --- a/dialogflow_v2beta1/gapic/transports/sessions_grpc_transport.py +++ /dev/null @@ -1,140 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from dialogflow_v2beta1.proto import session_pb2_grpc - - -class SessionsGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.dialogflow.v2beta1 Sessions API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/dialogflow", - ) - - def __init__( - self, channel=None, credentials=None, address="dialogflow.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = {"sessions_stub": session_pb2_grpc.SessionsStub(channel)} - - @classmethod - def create_channel( - cls, address="dialogflow.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def detect_intent(self): - """Return the gRPC stub for :meth:`SessionsClient.detect_intent`. - - Processes a natural language query and returns structured, actionable data - as a result. This method is not idempotent, because it may cause contexts - and session entity types to be updated, which in turn might affect - results of future queries. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["sessions_stub"].DetectIntent - - @property - def streaming_detect_intent(self): - """Return the gRPC stub for :meth:`SessionsClient.streaming_detect_intent`. - - Processes a natural language query in audio format in a streaming fashion - and returns structured, actionable data as a result. This method is only - available via the gRPC API (not REST). - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["sessions_stub"].StreamingDetectIntent diff --git a/dialogflow_v2beta1/proto/__init__.py b/dialogflow_v2beta1/proto/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/dialogflow_v2beta1/proto/agent_pb2.py b/dialogflow_v2beta1/proto/agent_pb2.py deleted file mode 100644 index e50e20bcf..000000000 --- a/dialogflow_v2beta1/proto/agent_pb2.py +++ /dev/null @@ -1,1712 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/agent.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from dialogflow_v2beta1.proto import ( - environment_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_environment__pb2, -) -from dialogflow_v2beta1.proto import ( - validation_result_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_validation__result__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/agent.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\nAgentProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n1google/cloud/dialogflow_v2beta1/proto/agent.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x37google/cloud/dialogflow_v2beta1/proto/environment.proto\x1a=google/cloud/dialogflow_v2beta1/proto/validation_result.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\xc2\x06\n\x05\x41gent\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x1d\n\x15\x64\x65\x66\x61ult_language_code\x18\x03 \x01(\t\x12 \n\x18supported_language_codes\x18\x04 \x03(\t\x12\x11\n\ttime_zone\x18\x05 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x06 \x01(\t\x12\x12\n\navatar_uri\x18\x07 \x01(\t\x12\x16\n\x0e\x65nable_logging\x18\x08 \x01(\x08\x12\x44\n\nmatch_mode\x18\t \x01(\x0e\x32\x30.google.cloud.dialogflow.v2beta1.Agent.MatchMode\x12 \n\x18\x63lassification_threshold\x18\n \x01(\x02\x12\x46\n\x0b\x61pi_version\x18\x0e \x01(\x0e\x32\x31.google.cloud.dialogflow.v2beta1.Agent.ApiVersion\x12\x39\n\x04tier\x18\x0f \x01(\x0e\x32+.google.cloud.dialogflow.v2beta1.Agent.Tier"V\n\tMatchMode\x12\x1a\n\x16MATCH_MODE_UNSPECIFIED\x10\x00\x12\x15\n\x11MATCH_MODE_HYBRID\x10\x01\x12\x16\n\x12MATCH_MODE_ML_ONLY\x10\x02"l\n\nApiVersion\x12\x1b\n\x17\x41PI_VERSION_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x41PI_VERSION_V1\x10\x01\x12\x12\n\x0e\x41PI_VERSION_V2\x10\x02\x12\x19\n\x15\x41PI_VERSION_V2_BETA_1\x10\x03"^\n\x04Tier\x12\x14\n\x10TIER_UNSPECIFIED\x10\x00\x12\x11\n\rTIER_STANDARD\x10\x01\x12\x13\n\x0fTIER_ENTERPRISE\x10\x02\x12\x18\n\x14TIER_ENTERPRISE_PLUS\x10\x03:m\xea\x41j\n\x1f\x64ialogflow.googleapis.com/Agent\x12\x18projects/{project}/agent\x12-projects/{project}/locations/{location}/agent"J\n\x0fGetAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent"~\n\x0fSetAgentRequest\x12:\n\x05\x61gent\x18\x01 \x01(\x0b\x32&.google.cloud.dialogflow.v2beta1.AgentB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"M\n\x12\x44\x65leteAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent"0\n\x08SubAgent\x12\x0f\n\x07project\x18\x01 \x01(\t\x12\x13\n\x0b\x65nvironment\x18\x02 \x01(\t"u\n\x13SearchAgentsRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"g\n\x14SearchAgentsResponse\x12\x36\n\x06\x61gents\x18\x01 \x03(\x0b\x32&.google.cloud.dialogflow.v2beta1.Agent\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"L\n\x11TrainAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent"`\n\x12\x45xportAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent\x12\x11\n\tagent_uri\x18\x02 \x01(\t"L\n\x13\x45xportAgentResponse\x12\x13\n\tagent_uri\x18\x01 \x01(\tH\x00\x12\x17\n\ragent_content\x18\x02 \x01(\x0cH\x00\x42\x07\n\x05\x61gent"\x84\x01\n\x12ImportAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent\x12\x13\n\tagent_uri\x18\x02 \x01(\tH\x00\x12\x17\n\ragent_content\x18\x03 \x01(\x0cH\x00\x42\x07\n\x05\x61gent"\x85\x01\n\x13RestoreAgentRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent\x12\x13\n\tagent_uri\x18\x02 \x01(\tH\x00\x12\x17\n\ragent_content\x18\x03 \x01(\x0cH\x00\x42\x07\n\x05\x61gent"q\n\x1aGetValidationResultRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x64ialogflow.googleapis.com/Agent\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01\x32\x87\x12\n\x06\x41gents\x12\xcb\x01\n\x08GetAgent\x12\x30.google.cloud.dialogflow.v2beta1.GetAgentRequest\x1a&.google.cloud.dialogflow.v2beta1.Agent"e\x82\xd3\xe4\x93\x02V\x12"/v2beta1/{parent=projects/*}/agentZ0\x12./v2beta1/{parent=projects/*/locations/*}/agent\xda\x41\x06parent\x12\xe4\x01\n\x08SetAgent\x12\x30.google.cloud.dialogflow.v2beta1.SetAgentRequest\x1a&.google.cloud.dialogflow.v2beta1.Agent"~\x82\xd3\xe4\x93\x02p"(/v2beta1/{agent.parent=projects/*}/agent:\x05\x61gentZ="4/v2beta1/{agent.parent=projects/*/locations/*}/agent:\x05\x61gent\xda\x41\x05\x61gent\x12\xc1\x01\n\x0b\x44\x65leteAgent\x12\x33.google.cloud.dialogflow.v2beta1.DeleteAgentRequest\x1a\x16.google.protobuf.Empty"e\x82\xd3\xe4\x93\x02V*"/v2beta1/{parent=projects/*}/agentZ0*./v2beta1/{parent=projects/*/locations/*}/agent\xda\x41\x06parent\x12\xf0\x01\n\x0cSearchAgents\x12\x34.google.cloud.dialogflow.v2beta1.SearchAgentsRequest\x1a\x35.google.cloud.dialogflow.v2beta1.SearchAgentsResponse"s\x82\xd3\xe4\x93\x02\x64\x12)/v2beta1/{parent=projects/*}/agent:searchZ7\x12\x35/v2beta1/{parent=projects/*/locations/*}/agent:search\xda\x41\x06parent\x12\x8b\x02\n\nTrainAgent\x12\x32.google.cloud.dialogflow.v2beta1.TrainAgentRequest\x1a\x1d.google.longrunning.Operation"\xa9\x01\x82\xd3\xe4\x93\x02h"(/v2beta1/{parent=projects/*}/agent:train:\x01*Z9"4/v2beta1/{parent=projects/*/locations/*}/agent:train:\x01*\xda\x41\x06parent\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\xad\x02\n\x0b\x45xportAgent\x12\x33.google.cloud.dialogflow.v2beta1.ExportAgentRequest\x1a\x1d.google.longrunning.Operation"\xc9\x01\x82\xd3\xe4\x93\x02j")/v2beta1/{parent=projects/*}/agent:export:\x01*Z:"5/v2beta1/{parent=projects/*/locations/*}/agent:export:\x01*\xda\x41\x06parent\xca\x41M\n3google.cloud.dialogflow.v2beta1.ExportAgentResponse\x12\x16google.protobuf.Struct\x12\x86\x02\n\x0bImportAgent\x12\x33.google.cloud.dialogflow.v2beta1.ImportAgentRequest\x1a\x1d.google.longrunning.Operation"\xa2\x01\x82\xd3\xe4\x93\x02j")/v2beta1/{parent=projects/*}/agent:import:\x01*Z:"5/v2beta1/{parent=projects/*/locations/*}/agent:import:\x01*\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\x8a\x02\n\x0cRestoreAgent\x12\x34.google.cloud.dialogflow.v2beta1.RestoreAgentRequest\x1a\x1d.google.longrunning.Operation"\xa4\x01\x82\xd3\xe4\x93\x02l"*/v2beta1/{parent=projects/*}/agent:restore:\x01*Z;"6/v2beta1/{parent=projects/*/locations/*}/agent:restore:\x01*\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\xc2\x01\n\x13GetValidationResult\x12;.google.cloud.dialogflow.v2beta1.GetValidationResultRequest\x1a\x31.google.cloud.dialogflow.v2beta1.ValidationResult";\x82\xd3\xe4\x93\x02\x35\x12\x33/v2beta1/{parent=projects/*}/agent/validationResult\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\xa8\x01\n#com.google.cloud.dialogflow.v2beta1B\nAgentProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_environment__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_validation__result__pb2.DESCRIPTOR, - google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - ], -) - - -_AGENT_MATCHMODE = _descriptor.EnumDescriptor( - name="MatchMode", - full_name="google.cloud.dialogflow.v2beta1.Agent.MatchMode", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="MATCH_MODE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MATCH_MODE_HYBRID", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MATCH_MODE_ML_ONLY", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=853, - serialized_end=939, -) -_sym_db.RegisterEnumDescriptor(_AGENT_MATCHMODE) - -_AGENT_APIVERSION = _descriptor.EnumDescriptor( - name="ApiVersion", - full_name="google.cloud.dialogflow.v2beta1.Agent.ApiVersion", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="API_VERSION_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="API_VERSION_V1", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="API_VERSION_V2", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="API_VERSION_V2_BETA_1", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=941, - serialized_end=1049, -) -_sym_db.RegisterEnumDescriptor(_AGENT_APIVERSION) - -_AGENT_TIER = _descriptor.EnumDescriptor( - name="Tier", - full_name="google.cloud.dialogflow.v2beta1.Agent.Tier", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="TIER_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TIER_STANDARD", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TIER_ENTERPRISE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TIER_ENTERPRISE_PLUS", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1051, - serialized_end=1145, -) -_sym_db.RegisterEnumDescriptor(_AGENT_TIER) - - -_AGENT = _descriptor.Descriptor( - name="Agent", - full_name="google.cloud.dialogflow.v2beta1.Agent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.Agent.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.dialogflow.v2beta1.Agent.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="default_language_code", - full_name="google.cloud.dialogflow.v2beta1.Agent.default_language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="supported_language_codes", - full_name="google.cloud.dialogflow.v2beta1.Agent.supported_language_codes", - index=3, - number=4, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="time_zone", - full_name="google.cloud.dialogflow.v2beta1.Agent.time_zone", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2beta1.Agent.description", - index=5, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="avatar_uri", - full_name="google.cloud.dialogflow.v2beta1.Agent.avatar_uri", - index=6, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="enable_logging", - full_name="google.cloud.dialogflow.v2beta1.Agent.enable_logging", - index=7, - number=8, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="match_mode", - full_name="google.cloud.dialogflow.v2beta1.Agent.match_mode", - index=8, - number=9, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="classification_threshold", - full_name="google.cloud.dialogflow.v2beta1.Agent.classification_threshold", - index=9, - number=10, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="api_version", - full_name="google.cloud.dialogflow.v2beta1.Agent.api_version", - index=10, - number=14, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="tier", - full_name="google.cloud.dialogflow.v2beta1.Agent.tier", - index=11, - number=15, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_AGENT_MATCHMODE, _AGENT_APIVERSION, _AGENT_TIER], - serialized_options=b"\352Aj\n\037dialogflow.googleapis.com/Agent\022\030projects/{project}/agent\022-projects/{project}/locations/{location}/agent", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=422, - serialized_end=1256, -) - - -_GETAGENTREQUEST = _descriptor.Descriptor( - name="GetAgentRequest", - full_name="google.cloud.dialogflow.v2beta1.GetAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.GetAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1258, - serialized_end=1332, -) - - -_SETAGENTREQUEST = _descriptor.Descriptor( - name="SetAgentRequest", - full_name="google.cloud.dialogflow.v2beta1.SetAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="agent", - full_name="google.cloud.dialogflow.v2beta1.SetAgentRequest.agent", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2beta1.SetAgentRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1334, - serialized_end=1460, -) - - -_DELETEAGENTREQUEST = _descriptor.Descriptor( - name="DeleteAgentRequest", - full_name="google.cloud.dialogflow.v2beta1.DeleteAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.DeleteAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1462, - serialized_end=1539, -) - - -_SUBAGENT = _descriptor.Descriptor( - name="SubAgent", - full_name="google.cloud.dialogflow.v2beta1.SubAgent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project", - full_name="google.cloud.dialogflow.v2beta1.SubAgent.project", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="environment", - full_name="google.cloud.dialogflow.v2beta1.SubAgent.environment", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1541, - serialized_end=1589, -) - - -_SEARCHAGENTSREQUEST = _descriptor.Descriptor( - name="SearchAgentsRequest", - full_name="google.cloud.dialogflow.v2beta1.SearchAgentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.SearchAgentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2beta1.SearchAgentsRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2beta1.SearchAgentsRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1591, - serialized_end=1708, -) - - -_SEARCHAGENTSRESPONSE = _descriptor.Descriptor( - name="SearchAgentsResponse", - full_name="google.cloud.dialogflow.v2beta1.SearchAgentsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="agents", - full_name="google.cloud.dialogflow.v2beta1.SearchAgentsResponse.agents", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2beta1.SearchAgentsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1710, - serialized_end=1813, -) - - -_TRAINAGENTREQUEST = _descriptor.Descriptor( - name="TrainAgentRequest", - full_name="google.cloud.dialogflow.v2beta1.TrainAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.TrainAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1815, - serialized_end=1891, -) - - -_EXPORTAGENTREQUEST = _descriptor.Descriptor( - name="ExportAgentRequest", - full_name="google.cloud.dialogflow.v2beta1.ExportAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.ExportAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_uri", - full_name="google.cloud.dialogflow.v2beta1.ExportAgentRequest.agent_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1893, - serialized_end=1989, -) - - -_EXPORTAGENTRESPONSE = _descriptor.Descriptor( - name="ExportAgentResponse", - full_name="google.cloud.dialogflow.v2beta1.ExportAgentResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="agent_uri", - full_name="google.cloud.dialogflow.v2beta1.ExportAgentResponse.agent_uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_content", - full_name="google.cloud.dialogflow.v2beta1.ExportAgentResponse.agent_content", - index=1, - number=2, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="agent", - full_name="google.cloud.dialogflow.v2beta1.ExportAgentResponse.agent", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=1991, - serialized_end=2067, -) - - -_IMPORTAGENTREQUEST = _descriptor.Descriptor( - name="ImportAgentRequest", - full_name="google.cloud.dialogflow.v2beta1.ImportAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.ImportAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_uri", - full_name="google.cloud.dialogflow.v2beta1.ImportAgentRequest.agent_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_content", - full_name="google.cloud.dialogflow.v2beta1.ImportAgentRequest.agent_content", - index=2, - number=3, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="agent", - full_name="google.cloud.dialogflow.v2beta1.ImportAgentRequest.agent", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=2070, - serialized_end=2202, -) - - -_RESTOREAGENTREQUEST = _descriptor.Descriptor( - name="RestoreAgentRequest", - full_name="google.cloud.dialogflow.v2beta1.RestoreAgentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.RestoreAgentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_uri", - full_name="google.cloud.dialogflow.v2beta1.RestoreAgentRequest.agent_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_content", - full_name="google.cloud.dialogflow.v2beta1.RestoreAgentRequest.agent_content", - index=2, - number=3, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="agent", - full_name="google.cloud.dialogflow.v2beta1.RestoreAgentRequest.agent", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=2205, - serialized_end=2338, -) - - -_GETVALIDATIONRESULTREQUEST = _descriptor.Descriptor( - name="GetValidationResultRequest", - full_name="google.cloud.dialogflow.v2beta1.GetValidationResultRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.GetValidationResultRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\022\037dialogflow.googleapis.com/Agent", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.GetValidationResultRequest.language_code", - index=1, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2340, - serialized_end=2453, -) - -_AGENT.fields_by_name["match_mode"].enum_type = _AGENT_MATCHMODE -_AGENT.fields_by_name["api_version"].enum_type = _AGENT_APIVERSION -_AGENT.fields_by_name["tier"].enum_type = _AGENT_TIER -_AGENT_MATCHMODE.containing_type = _AGENT -_AGENT_APIVERSION.containing_type = _AGENT -_AGENT_TIER.containing_type = _AGENT -_SETAGENTREQUEST.fields_by_name["agent"].message_type = _AGENT -_SETAGENTREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_SEARCHAGENTSRESPONSE.fields_by_name["agents"].message_type = _AGENT -_EXPORTAGENTRESPONSE.oneofs_by_name["agent"].fields.append( - _EXPORTAGENTRESPONSE.fields_by_name["agent_uri"] -) -_EXPORTAGENTRESPONSE.fields_by_name[ - "agent_uri" -].containing_oneof = _EXPORTAGENTRESPONSE.oneofs_by_name["agent"] -_EXPORTAGENTRESPONSE.oneofs_by_name["agent"].fields.append( - _EXPORTAGENTRESPONSE.fields_by_name["agent_content"] -) -_EXPORTAGENTRESPONSE.fields_by_name[ - "agent_content" -].containing_oneof = _EXPORTAGENTRESPONSE.oneofs_by_name["agent"] -_IMPORTAGENTREQUEST.oneofs_by_name["agent"].fields.append( - _IMPORTAGENTREQUEST.fields_by_name["agent_uri"] -) -_IMPORTAGENTREQUEST.fields_by_name[ - "agent_uri" -].containing_oneof = _IMPORTAGENTREQUEST.oneofs_by_name["agent"] -_IMPORTAGENTREQUEST.oneofs_by_name["agent"].fields.append( - _IMPORTAGENTREQUEST.fields_by_name["agent_content"] -) -_IMPORTAGENTREQUEST.fields_by_name[ - "agent_content" -].containing_oneof = _IMPORTAGENTREQUEST.oneofs_by_name["agent"] -_RESTOREAGENTREQUEST.oneofs_by_name["agent"].fields.append( - _RESTOREAGENTREQUEST.fields_by_name["agent_uri"] -) -_RESTOREAGENTREQUEST.fields_by_name[ - "agent_uri" -].containing_oneof = _RESTOREAGENTREQUEST.oneofs_by_name["agent"] -_RESTOREAGENTREQUEST.oneofs_by_name["agent"].fields.append( - _RESTOREAGENTREQUEST.fields_by_name["agent_content"] -) -_RESTOREAGENTREQUEST.fields_by_name[ - "agent_content" -].containing_oneof = _RESTOREAGENTREQUEST.oneofs_by_name["agent"] -DESCRIPTOR.message_types_by_name["Agent"] = _AGENT -DESCRIPTOR.message_types_by_name["GetAgentRequest"] = _GETAGENTREQUEST -DESCRIPTOR.message_types_by_name["SetAgentRequest"] = _SETAGENTREQUEST -DESCRIPTOR.message_types_by_name["DeleteAgentRequest"] = _DELETEAGENTREQUEST -DESCRIPTOR.message_types_by_name["SubAgent"] = _SUBAGENT -DESCRIPTOR.message_types_by_name["SearchAgentsRequest"] = _SEARCHAGENTSREQUEST -DESCRIPTOR.message_types_by_name["SearchAgentsResponse"] = _SEARCHAGENTSRESPONSE -DESCRIPTOR.message_types_by_name["TrainAgentRequest"] = _TRAINAGENTREQUEST -DESCRIPTOR.message_types_by_name["ExportAgentRequest"] = _EXPORTAGENTREQUEST -DESCRIPTOR.message_types_by_name["ExportAgentResponse"] = _EXPORTAGENTRESPONSE -DESCRIPTOR.message_types_by_name["ImportAgentRequest"] = _IMPORTAGENTREQUEST -DESCRIPTOR.message_types_by_name["RestoreAgentRequest"] = _RESTOREAGENTREQUEST -DESCRIPTOR.message_types_by_name[ - "GetValidationResultRequest" -] = _GETVALIDATIONRESULTREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Agent = _reflection.GeneratedProtocolMessageType( - "Agent", - (_message.Message,), - { - "DESCRIPTOR": _AGENT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """A Dialogflow agent is a virtual agent that handles conversations with - your end-users. It is a natural language understanding module that - understands the nuances of human language. Dialogflow translates end- - user text or audio during a conversation to structured data that your - apps and services can understand. You design and build a Dialogflow - agent to handle the types of conversations required for your system. - For more information about agents, see the `Agent guide - `__. - - Attributes: - parent: - Required. The project of this agent. Format: - ``projects/``. - display_name: - Required. The name of this agent. - default_language_code: - Required. The default language of the agent as a language tag. - See `Language Support `__ for a list of the currently supported - language codes. This field cannot be set by the ``Update`` - method. - supported_language_codes: - Optional. The list of all languages supported by this agent - (except for the ``default_language_code``). - time_zone: - Required. The time zone of this agent from the `time zone - database `__, e.g., - America/New_York, Europe/Paris. - description: - Optional. The description of this agent. The maximum length is - 500 characters. If exceeded, the request is rejected. - avatar_uri: - Optional. The URI of the agent’s avatar. Avatars are used - throughout the Dialogflow console and in the self-hosted `Web - Demo - `__ integration. - enable_logging: - Optional. Determines whether this agent should log - conversation queries. - match_mode: - Optional. Determines how intents are detected from user - queries. - classification_threshold: - Optional. To filter out false positive results and still get - variety in matched natural language inputs for your agent, you - can tune the machine learning classification threshold. If the - returned score value is less than the threshold value, then a - fallback intent will be triggered or, if there are no fallback - intents defined, no intent will be triggered. The score values - range from 0.0 (completely uncertain) to 1.0 (completely - certain). If set to 0.0, the default of 0.3 is used. - api_version: - Optional. API version displayed in Dialogflow console. If not - specified, V2 API is assumed. Clients are free to query - different service endpoints for different API versions. - However, bots connectors and webhook calls will follow the - specified API version. - tier: - Optional. The agent tier. If not specified, TIER_STANDARD is - assumed. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Agent) - }, -) -_sym_db.RegisterMessage(Agent) - -GetAgentRequest = _reflection.GeneratedProtocolMessageType( - "GetAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The request message for - [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent]. - - Attributes: - parent: - Required. The project that the agent to fetch is associated - with. Format: ``projects/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.GetAgentRequest) - }, -) -_sym_db.RegisterMessage(GetAgentRequest) - -SetAgentRequest = _reflection.GeneratedProtocolMessageType( - "SetAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _SETAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The request message for - [Agents.SetAgent][google.cloud.dialogflow.v2beta1.Agents.SetAgent]. - - Attributes: - agent: - Required. The agent to update. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.SetAgentRequest) - }, -) -_sym_db.RegisterMessage(SetAgentRequest) - -DeleteAgentRequest = _reflection.GeneratedProtocolMessageType( - "DeleteAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The request message for [Agents.DeleteAgent][google.cloud.dialogflow.v - 2beta1.Agents.DeleteAgent]. - - Attributes: - parent: - Required. The project that the agent to delete is associated - with. Format: ``projects/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.DeleteAgentRequest) - }, -) -_sym_db.RegisterMessage(DeleteAgentRequest) - -SubAgent = _reflection.GeneratedProtocolMessageType( - "SubAgent", - (_message.Message,), - { - "DESCRIPTOR": _SUBAGENT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """Contains basic configuration for a sub-agent. - - Attributes: - project: - Required. The project of this agent. Format: - ``projects/``. - environment: - Optional. The unique identifier (``environment name`` in - dialogflow console) of this sub-agent environment. Assumes - draft environment if ``environment`` is not set. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.SubAgent) - }, -) -_sym_db.RegisterMessage(SubAgent) - -SearchAgentsRequest = _reflection.GeneratedProtocolMessageType( - "SearchAgentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _SEARCHAGENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The request message for [Agents.SearchAgents][google.cloud.dialogflow. - v2beta1.Agents.SearchAgents]. - - Attributes: - parent: - Required. The project to list agents from. Format: - ``projects/``. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.SearchAgentsRequest) - }, -) -_sym_db.RegisterMessage(SearchAgentsRequest) - -SearchAgentsResponse = _reflection.GeneratedProtocolMessageType( - "SearchAgentsResponse", - (_message.Message,), - { - "DESCRIPTOR": _SEARCHAGENTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The response message for [Agents.SearchAgents][google.cloud.dialogflow - .v2beta1.Agents.SearchAgents]. - - Attributes: - agents: - The list of agents. There will be a maximum number of items - returned based on the page_size field in the request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.SearchAgentsResponse) - }, -) -_sym_db.RegisterMessage(SearchAgentsResponse) - -TrainAgentRequest = _reflection.GeneratedProtocolMessageType( - "TrainAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _TRAINAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The request message for [Agents.TrainAgent][google.cloud.dialogflow.v2 - beta1.Agents.TrainAgent]. - - Attributes: - parent: - Required. The project that the agent to train is associated - with. Format: ``projects/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.TrainAgentRequest) - }, -) -_sym_db.RegisterMessage(TrainAgentRequest) - -ExportAgentRequest = _reflection.GeneratedProtocolMessageType( - "ExportAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _EXPORTAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The request message for [Agents.ExportAgent][google.cloud.dialogflow.v - 2beta1.Agents.ExportAgent]. - - Attributes: - parent: - Required. The project that the agent to export is associated - with. Format: ``projects/``. - agent_uri: - Optional. The `Google Cloud Storage - `__ URI to export the - agent to. The format of this URI must be ``gs:///``. If left unspecified, the serialized - agent is returned inline. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ExportAgentRequest) - }, -) -_sym_db.RegisterMessage(ExportAgentRequest) - -ExportAgentResponse = _reflection.GeneratedProtocolMessageType( - "ExportAgentResponse", - (_message.Message,), - { - "DESCRIPTOR": _EXPORTAGENTRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The response message for [Agents.ExportAgent][google.cloud.dialogflow. - v2beta1.Agents.ExportAgent]. - - Attributes: - agent: - The exported agent. - agent_uri: - The URI to a file containing the exported agent. This field is - populated only if ``agent_uri`` is specified in - ``ExportAgentRequest``. - agent_content: - Zip compressed raw byte content for agent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ExportAgentResponse) - }, -) -_sym_db.RegisterMessage(ExportAgentResponse) - -ImportAgentRequest = _reflection.GeneratedProtocolMessageType( - "ImportAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _IMPORTAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The request message for [Agents.ImportAgent][google.cloud.dialogflow.v - 2beta1.Agents.ImportAgent]. - - Attributes: - parent: - Required. The project that the agent to import is associated - with. Format: ``projects/``. - agent: - Required. The agent to import. - agent_uri: - The URI to a Google Cloud Storage file containing the agent to - import. Note: The URI must start with “gs://”. - agent_content: - Zip compressed raw byte content for agent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ImportAgentRequest) - }, -) -_sym_db.RegisterMessage(ImportAgentRequest) - -RestoreAgentRequest = _reflection.GeneratedProtocolMessageType( - "RestoreAgentRequest", - (_message.Message,), - { - "DESCRIPTOR": _RESTOREAGENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The request message for [Agents.RestoreAgent][google.cloud.dialogflow. - v2beta1.Agents.RestoreAgent]. - - Attributes: - parent: - Required. The project that the agent to restore is associated - with. Format: ``projects/``. - agent: - Required. The agent to restore. - agent_uri: - The URI to a Google Cloud Storage file containing the agent to - restore. Note: The URI must start with “gs://”. - agent_content: - Zip compressed raw byte content for agent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.RestoreAgentRequest) - }, -) -_sym_db.RegisterMessage(RestoreAgentRequest) - -GetValidationResultRequest = _reflection.GeneratedProtocolMessageType( - "GetValidationResultRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETVALIDATIONRESULTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.agent_pb2", - "__doc__": """The request message for [Agents.GetValidationResult][google.cloud.dial - ogflow.v2beta1.Agents.GetValidationResult]. - - Attributes: - parent: - Required. The project that the agent is associated with. - Format: ``projects/``. - language_code: - Optional. The language for which you want a validation result. - If not specified, the agent’s default language is used. `Many - languages `__ are supported. Note: languages must be enabled in - the agent before they can be used. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.GetValidationResultRequest) - }, -) -_sym_db.RegisterMessage(GetValidationResultRequest) - - -DESCRIPTOR._options = None -_AGENT._options = None -_GETAGENTREQUEST.fields_by_name["parent"]._options = None -_SETAGENTREQUEST.fields_by_name["agent"]._options = None -_DELETEAGENTREQUEST.fields_by_name["parent"]._options = None -_SEARCHAGENTSREQUEST.fields_by_name["parent"]._options = None -_TRAINAGENTREQUEST.fields_by_name["parent"]._options = None -_EXPORTAGENTREQUEST.fields_by_name["parent"]._options = None -_IMPORTAGENTREQUEST.fields_by_name["parent"]._options = None -_RESTOREAGENTREQUEST.fields_by_name["parent"]._options = None -_GETVALIDATIONRESULTREQUEST.fields_by_name["parent"]._options = None -_GETVALIDATIONRESULTREQUEST.fields_by_name["language_code"]._options = None - -_AGENTS = _descriptor.ServiceDescriptor( - name="Agents", - full_name="google.cloud.dialogflow.v2beta1.Agents", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=2456, - serialized_end=4767, - methods=[ - _descriptor.MethodDescriptor( - name="GetAgent", - full_name="google.cloud.dialogflow.v2beta1.Agents.GetAgent", - index=0, - containing_service=None, - input_type=_GETAGENTREQUEST, - output_type=_AGENT, - serialized_options=b'\202\323\344\223\002V\022"/v2beta1/{parent=projects/*}/agentZ0\022./v2beta1/{parent=projects/*/locations/*}/agent\332A\006parent', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="SetAgent", - full_name="google.cloud.dialogflow.v2beta1.Agents.SetAgent", - index=1, - containing_service=None, - input_type=_SETAGENTREQUEST, - output_type=_AGENT, - serialized_options=b'\202\323\344\223\002p"(/v2beta1/{agent.parent=projects/*}/agent:\005agentZ="4/v2beta1/{agent.parent=projects/*/locations/*}/agent:\005agent\332A\005agent', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteAgent", - full_name="google.cloud.dialogflow.v2beta1.Agents.DeleteAgent", - index=2, - containing_service=None, - input_type=_DELETEAGENTREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b'\202\323\344\223\002V*"/v2beta1/{parent=projects/*}/agentZ0*./v2beta1/{parent=projects/*/locations/*}/agent\332A\006parent', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="SearchAgents", - full_name="google.cloud.dialogflow.v2beta1.Agents.SearchAgents", - index=3, - containing_service=None, - input_type=_SEARCHAGENTSREQUEST, - output_type=_SEARCHAGENTSRESPONSE, - serialized_options=b"\202\323\344\223\002d\022)/v2beta1/{parent=projects/*}/agent:searchZ7\0225/v2beta1/{parent=projects/*/locations/*}/agent:search\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="TrainAgent", - full_name="google.cloud.dialogflow.v2beta1.Agents.TrainAgent", - index=4, - containing_service=None, - input_type=_TRAINAGENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002h"(/v2beta1/{parent=projects/*}/agent:train:\001*Z9"4/v2beta1/{parent=projects/*/locations/*}/agent:train:\001*\332A\006parent\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ExportAgent", - full_name="google.cloud.dialogflow.v2beta1.Agents.ExportAgent", - index=5, - containing_service=None, - input_type=_EXPORTAGENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002j")/v2beta1/{parent=projects/*}/agent:export:\001*Z:"5/v2beta1/{parent=projects/*/locations/*}/agent:export:\001*\332A\006parent\312AM\n3google.cloud.dialogflow.v2beta1.ExportAgentResponse\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ImportAgent", - full_name="google.cloud.dialogflow.v2beta1.Agents.ImportAgent", - index=6, - containing_service=None, - input_type=_IMPORTAGENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002j")/v2beta1/{parent=projects/*}/agent:import:\001*Z:"5/v2beta1/{parent=projects/*/locations/*}/agent:import:\001*\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="RestoreAgent", - full_name="google.cloud.dialogflow.v2beta1.Agents.RestoreAgent", - index=7, - containing_service=None, - input_type=_RESTOREAGENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002l"*/v2beta1/{parent=projects/*}/agent:restore:\001*Z;"6/v2beta1/{parent=projects/*/locations/*}/agent:restore:\001*\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetValidationResult", - full_name="google.cloud.dialogflow.v2beta1.Agents.GetValidationResult", - index=8, - containing_service=None, - input_type=_GETVALIDATIONRESULTREQUEST, - output_type=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_validation__result__pb2._VALIDATIONRESULT, - serialized_options=b"\202\323\344\223\0025\0223/v2beta1/{parent=projects/*}/agent/validationResult", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_AGENTS) - -DESCRIPTOR.services_by_name["Agents"] = _AGENTS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/agent_pb2_grpc.py b/dialogflow_v2beta1/proto/agent_pb2_grpc.py deleted file mode 100644 index a0c3295bf..000000000 --- a/dialogflow_v2beta1/proto/agent_pb2_grpc.py +++ /dev/null @@ -1,479 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2beta1.proto import ( - agent_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2, -) -from dialogflow_v2beta1.proto import ( - validation_result_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_validation__result__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class AgentsStub(object): - """Service for managing [Agents][google.cloud.dialogflow.v2beta1.Agent]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.GetAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Agents/GetAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.GetAgentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.Agent.FromString, - ) - self.SetAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Agents/SetAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.SetAgentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.Agent.FromString, - ) - self.DeleteAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Agents/DeleteAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.DeleteAgentRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.SearchAgents = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Agents/SearchAgents", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.SearchAgentsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.SearchAgentsResponse.FromString, - ) - self.TrainAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Agents/TrainAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.TrainAgentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.ExportAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Agents/ExportAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.ExportAgentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.ImportAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Agents/ImportAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.ImportAgentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.RestoreAgent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Agents/RestoreAgent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.RestoreAgentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.GetValidationResult = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Agents/GetValidationResult", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.GetValidationResultRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_validation__result__pb2.ValidationResult.FromString, - ) - - -class AgentsServicer(object): - """Service for managing [Agents][google.cloud.dialogflow.v2beta1.Agent]. - """ - - def GetAgent(self, request, context): - """Retrieves the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def SetAgent(self, request, context): - """Creates/updates the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteAgent(self, request, context): - """Deletes the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def SearchAgents(self, request, context): - """Returns the list of agents. - Since there is at most one conversational agent per project, this method is - useful primarily for listing all agents across projects the caller has - access to. One can achieve that with a wildcard project collection id "-". - Refer to [List - Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def TrainAgent(self, request, context): - """Trains the specified agent. - - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ExportAgent(self, request, context): - """Exports the specified agent to a ZIP file. - - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ImportAgent(self, request, context): - """Imports the specified agent from a ZIP file. - - Uploads new intents and entity types without deleting the existing ones. - Intents and entity types with the same name are replaced with the new - versions from [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the imported draft - agent will be trained automatically (unless disabled in agent settings). - However, once the import is done, training may not be completed yet. Please - call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train - explicitly. - - - Operation - An operation which tracks when importing is complete. It only tracks - when the draft agent is updated not when it is done training. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def RestoreAgent(self, request, context): - """Restores the specified agent from a ZIP file. - - Replaces the current agent version with a new one. All the intents and - entity types in the older version are deleted. After the restore, the - restored draft agent will be trained automatically (unless disabled in - agent settings). However, once the restore is done, training may not be - completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it - returns in order to train explicitly. - - - Operation - An operation which tracks when restoring is complete. It only tracks - when the draft agent is updated not when it is done training. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetValidationResult(self, request, context): - """Gets agent validation result. Agent validation is performed during - training time and is updated automatically when training is completed. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_AgentsServicer_to_server(servicer, server): - rpc_method_handlers = { - "GetAgent": grpc.unary_unary_rpc_method_handler( - servicer.GetAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.GetAgentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.Agent.SerializeToString, - ), - "SetAgent": grpc.unary_unary_rpc_method_handler( - servicer.SetAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.SetAgentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.Agent.SerializeToString, - ), - "DeleteAgent": grpc.unary_unary_rpc_method_handler( - servicer.DeleteAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.DeleteAgentRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "SearchAgents": grpc.unary_unary_rpc_method_handler( - servicer.SearchAgents, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.SearchAgentsRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.SearchAgentsResponse.SerializeToString, - ), - "TrainAgent": grpc.unary_unary_rpc_method_handler( - servicer.TrainAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.TrainAgentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "ExportAgent": grpc.unary_unary_rpc_method_handler( - servicer.ExportAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.ExportAgentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "ImportAgent": grpc.unary_unary_rpc_method_handler( - servicer.ImportAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.ImportAgentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "RestoreAgent": grpc.unary_unary_rpc_method_handler( - servicer.RestoreAgent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.RestoreAgentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "GetValidationResult": grpc.unary_unary_rpc_method_handler( - servicer.GetValidationResult, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.GetValidationResultRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_validation__result__pb2.ValidationResult.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2beta1.Agents", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Agents(object): - """Service for managing [Agents][google.cloud.dialogflow.v2beta1.Agent]. - """ - - @staticmethod - def GetAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Agents/GetAgent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.GetAgentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.Agent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def SetAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Agents/SetAgent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.SetAgentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.Agent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Agents/DeleteAgent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.DeleteAgentRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def SearchAgents( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Agents/SearchAgents", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.SearchAgentsRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.SearchAgentsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def TrainAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Agents/TrainAgent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.TrainAgentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def ExportAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Agents/ExportAgent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.ExportAgentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def ImportAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Agents/ImportAgent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.ImportAgentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def RestoreAgent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Agents/RestoreAgent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.RestoreAgentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetValidationResult( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Agents/GetValidationResult", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.GetValidationResultRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_validation__result__pb2.ValidationResult.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2beta1/proto/audio_config_pb2.py b/dialogflow_v2beta1/proto/audio_config_pb2.py deleted file mode 100644 index 30f56d611..000000000 --- a/dialogflow_v2beta1/proto/audio_config_pb2.py +++ /dev/null @@ -1,1164 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/audio_config.proto -"""Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/audio_config.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\020AudioConfigProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n8google/cloud/dialogflow_v2beta1/proto/audio_config.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/api/annotations.proto"/\n\rSpeechContext\x12\x0f\n\x07phrases\x18\x01 \x03(\t\x12\r\n\x05\x62oost\x18\x02 \x01(\x02"\x92\x01\n\x0eSpeechWordInfo\x12\x0c\n\x04word\x18\x03 \x01(\t\x12/\n\x0cstart_offset\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12-\n\nend_offset\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x12\n\nconfidence\x18\x04 \x01(\x02"\xfe\x02\n\x10InputAudioConfig\x12\x46\n\x0e\x61udio_encoding\x18\x01 \x01(\x0e\x32..google.cloud.dialogflow.v2beta1.AudioEncoding\x12\x19\n\x11sample_rate_hertz\x18\x02 \x01(\x05\x12\x15\n\rlanguage_code\x18\x03 \x01(\t\x12\x18\n\x10\x65nable_word_info\x18\r \x01(\x08\x12\x18\n\x0cphrase_hints\x18\x04 \x03(\tB\x02\x18\x01\x12G\n\x0fspeech_contexts\x18\x0b \x03(\x0b\x32..google.cloud.dialogflow.v2beta1.SpeechContext\x12\r\n\x05model\x18\x07 \x01(\t\x12J\n\rmodel_variant\x18\n \x01(\x0e\x32\x33.google.cloud.dialogflow.v2beta1.SpeechModelVariant\x12\x18\n\x10single_utterance\x18\x08 \x01(\x08"k\n\x14VoiceSelectionParams\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x45\n\x0bssml_gender\x18\x02 \x01(\x0e\x32\x30.google.cloud.dialogflow.v2beta1.SsmlVoiceGender"\xb8\x01\n\x16SynthesizeSpeechConfig\x12\x15\n\rspeaking_rate\x18\x01 \x01(\x01\x12\r\n\x05pitch\x18\x02 \x01(\x01\x12\x16\n\x0evolume_gain_db\x18\x03 \x01(\x01\x12\x1a\n\x12\x65\x66\x66\x65\x63ts_profile_id\x18\x05 \x03(\t\x12\x44\n\x05voice\x18\x04 \x01(\x0b\x32\x35.google.cloud.dialogflow.v2beta1.VoiceSelectionParams"\xdc\x01\n\x11OutputAudioConfig\x12Q\n\x0e\x61udio_encoding\x18\x01 \x01(\x0e\x32\x34.google.cloud.dialogflow.v2beta1.OutputAudioEncodingB\x03\xe0\x41\x02\x12\x19\n\x11sample_rate_hertz\x18\x02 \x01(\x05\x12Y\n\x18synthesize_speech_config\x18\x03 \x01(\x0b\x32\x37.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig*\xfb\x01\n\rAudioEncoding\x12\x1e\n\x1a\x41UDIO_ENCODING_UNSPECIFIED\x10\x00\x12\x1c\n\x18\x41UDIO_ENCODING_LINEAR_16\x10\x01\x12\x17\n\x13\x41UDIO_ENCODING_FLAC\x10\x02\x12\x18\n\x14\x41UDIO_ENCODING_MULAW\x10\x03\x12\x16\n\x12\x41UDIO_ENCODING_AMR\x10\x04\x12\x19\n\x15\x41UDIO_ENCODING_AMR_WB\x10\x05\x12\x1b\n\x17\x41UDIO_ENCODING_OGG_OPUS\x10\x06\x12)\n%AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE\x10\x07*v\n\x12SpeechModelVariant\x12$\n SPEECH_MODEL_VARIANT_UNSPECIFIED\x10\x00\x12\x16\n\x12USE_BEST_AVAILABLE\x10\x01\x12\x10\n\x0cUSE_STANDARD\x10\x02\x12\x10\n\x0cUSE_ENHANCED\x10\x03*\x8d\x01\n\x0fSsmlVoiceGender\x12!\n\x1dSSML_VOICE_GENDER_UNSPECIFIED\x10\x00\x12\x1a\n\x16SSML_VOICE_GENDER_MALE\x10\x01\x12\x1c\n\x18SSML_VOICE_GENDER_FEMALE\x10\x02\x12\x1d\n\x19SSML_VOICE_GENDER_NEUTRAL\x10\x03*\xa4\x01\n\x13OutputAudioEncoding\x12%\n!OUTPUT_AUDIO_ENCODING_UNSPECIFIED\x10\x00\x12#\n\x1fOUTPUT_AUDIO_ENCODING_LINEAR_16\x10\x01\x12\x1d\n\x19OUTPUT_AUDIO_ENCODING_MP3\x10\x02\x12"\n\x1eOUTPUT_AUDIO_ENCODING_OGG_OPUS\x10\x03\x42\xae\x01\n#com.google.cloud.dialogflow.v2beta1B\x10\x41udioConfigProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[ - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - -_AUDIOENCODING = _descriptor.EnumDescriptor( - name="AudioEncoding", - full_name="google.cloud.dialogflow.v2beta1.AudioEncoding", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_LINEAR_16", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_FLAC", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_MULAW", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_AMR", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_AMR_WB", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_OGG_OPUS", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1352, - serialized_end=1603, -) -_sym_db.RegisterEnumDescriptor(_AUDIOENCODING) - -AudioEncoding = enum_type_wrapper.EnumTypeWrapper(_AUDIOENCODING) -_SPEECHMODELVARIANT = _descriptor.EnumDescriptor( - name="SpeechModelVariant", - full_name="google.cloud.dialogflow.v2beta1.SpeechModelVariant", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="SPEECH_MODEL_VARIANT_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="USE_BEST_AVAILABLE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="USE_STANDARD", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="USE_ENHANCED", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1605, - serialized_end=1723, -) -_sym_db.RegisterEnumDescriptor(_SPEECHMODELVARIANT) - -SpeechModelVariant = enum_type_wrapper.EnumTypeWrapper(_SPEECHMODELVARIANT) -_SSMLVOICEGENDER = _descriptor.EnumDescriptor( - name="SsmlVoiceGender", - full_name="google.cloud.dialogflow.v2beta1.SsmlVoiceGender", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="SSML_VOICE_GENDER_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SSML_VOICE_GENDER_MALE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SSML_VOICE_GENDER_FEMALE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SSML_VOICE_GENDER_NEUTRAL", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1726, - serialized_end=1867, -) -_sym_db.RegisterEnumDescriptor(_SSMLVOICEGENDER) - -SsmlVoiceGender = enum_type_wrapper.EnumTypeWrapper(_SSMLVOICEGENDER) -_OUTPUTAUDIOENCODING = _descriptor.EnumDescriptor( - name="OutputAudioEncoding", - full_name="google.cloud.dialogflow.v2beta1.OutputAudioEncoding", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="OUTPUT_AUDIO_ENCODING_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OUTPUT_AUDIO_ENCODING_LINEAR_16", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OUTPUT_AUDIO_ENCODING_MP3", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OUTPUT_AUDIO_ENCODING_OGG_OPUS", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1870, - serialized_end=2034, -) -_sym_db.RegisterEnumDescriptor(_OUTPUTAUDIOENCODING) - -OutputAudioEncoding = enum_type_wrapper.EnumTypeWrapper(_OUTPUTAUDIOENCODING) -AUDIO_ENCODING_UNSPECIFIED = 0 -AUDIO_ENCODING_LINEAR_16 = 1 -AUDIO_ENCODING_FLAC = 2 -AUDIO_ENCODING_MULAW = 3 -AUDIO_ENCODING_AMR = 4 -AUDIO_ENCODING_AMR_WB = 5 -AUDIO_ENCODING_OGG_OPUS = 6 -AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 -SPEECH_MODEL_VARIANT_UNSPECIFIED = 0 -USE_BEST_AVAILABLE = 1 -USE_STANDARD = 2 -USE_ENHANCED = 3 -SSML_VOICE_GENDER_UNSPECIFIED = 0 -SSML_VOICE_GENDER_MALE = 1 -SSML_VOICE_GENDER_FEMALE = 2 -SSML_VOICE_GENDER_NEUTRAL = 3 -OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0 -OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1 -OUTPUT_AUDIO_ENCODING_MP3 = 2 -OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3 - - -_SPEECHCONTEXT = _descriptor.Descriptor( - name="SpeechContext", - full_name="google.cloud.dialogflow.v2beta1.SpeechContext", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="phrases", - full_name="google.cloud.dialogflow.v2beta1.SpeechContext.phrases", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="boost", - full_name="google.cloud.dialogflow.v2beta1.SpeechContext.boost", - index=1, - number=2, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=249, - serialized_end=296, -) - - -_SPEECHWORDINFO = _descriptor.Descriptor( - name="SpeechWordInfo", - full_name="google.cloud.dialogflow.v2beta1.SpeechWordInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="word", - full_name="google.cloud.dialogflow.v2beta1.SpeechWordInfo.word", - index=0, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="start_offset", - full_name="google.cloud.dialogflow.v2beta1.SpeechWordInfo.start_offset", - index=1, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_offset", - full_name="google.cloud.dialogflow.v2beta1.SpeechWordInfo.end_offset", - index=2, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="confidence", - full_name="google.cloud.dialogflow.v2beta1.SpeechWordInfo.confidence", - index=3, - number=4, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=299, - serialized_end=445, -) - - -_INPUTAUDIOCONFIG = _descriptor.Descriptor( - name="InputAudioConfig", - full_name="google.cloud.dialogflow.v2beta1.InputAudioConfig", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="audio_encoding", - full_name="google.cloud.dialogflow.v2beta1.InputAudioConfig.audio_encoding", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sample_rate_hertz", - full_name="google.cloud.dialogflow.v2beta1.InputAudioConfig.sample_rate_hertz", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.InputAudioConfig.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="enable_word_info", - full_name="google.cloud.dialogflow.v2beta1.InputAudioConfig.enable_word_info", - index=3, - number=13, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="phrase_hints", - full_name="google.cloud.dialogflow.v2beta1.InputAudioConfig.phrase_hints", - index=4, - number=4, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\030\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="speech_contexts", - full_name="google.cloud.dialogflow.v2beta1.InputAudioConfig.speech_contexts", - index=5, - number=11, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="model", - full_name="google.cloud.dialogflow.v2beta1.InputAudioConfig.model", - index=6, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="model_variant", - full_name="google.cloud.dialogflow.v2beta1.InputAudioConfig.model_variant", - index=7, - number=10, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="single_utterance", - full_name="google.cloud.dialogflow.v2beta1.InputAudioConfig.single_utterance", - index=8, - number=8, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=448, - serialized_end=830, -) - - -_VOICESELECTIONPARAMS = _descriptor.Descriptor( - name="VoiceSelectionParams", - full_name="google.cloud.dialogflow.v2beta1.VoiceSelectionParams", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.VoiceSelectionParams.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="ssml_gender", - full_name="google.cloud.dialogflow.v2beta1.VoiceSelectionParams.ssml_gender", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=832, - serialized_end=939, -) - - -_SYNTHESIZESPEECHCONFIG = _descriptor.Descriptor( - name="SynthesizeSpeechConfig", - full_name="google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="speaking_rate", - full_name="google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.speaking_rate", - index=0, - number=1, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="pitch", - full_name="google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.pitch", - index=1, - number=2, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="volume_gain_db", - full_name="google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.volume_gain_db", - index=2, - number=3, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="effects_profile_id", - full_name="google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.effects_profile_id", - index=3, - number=5, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="voice", - full_name="google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.voice", - index=4, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=942, - serialized_end=1126, -) - - -_OUTPUTAUDIOCONFIG = _descriptor.Descriptor( - name="OutputAudioConfig", - full_name="google.cloud.dialogflow.v2beta1.OutputAudioConfig", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="audio_encoding", - full_name="google.cloud.dialogflow.v2beta1.OutputAudioConfig.audio_encoding", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sample_rate_hertz", - full_name="google.cloud.dialogflow.v2beta1.OutputAudioConfig.sample_rate_hertz", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="synthesize_speech_config", - full_name="google.cloud.dialogflow.v2beta1.OutputAudioConfig.synthesize_speech_config", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1129, - serialized_end=1349, -) - -_SPEECHWORDINFO.fields_by_name[ - "start_offset" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_SPEECHWORDINFO.fields_by_name[ - "end_offset" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_INPUTAUDIOCONFIG.fields_by_name["audio_encoding"].enum_type = _AUDIOENCODING -_INPUTAUDIOCONFIG.fields_by_name["speech_contexts"].message_type = _SPEECHCONTEXT -_INPUTAUDIOCONFIG.fields_by_name["model_variant"].enum_type = _SPEECHMODELVARIANT -_VOICESELECTIONPARAMS.fields_by_name["ssml_gender"].enum_type = _SSMLVOICEGENDER -_SYNTHESIZESPEECHCONFIG.fields_by_name["voice"].message_type = _VOICESELECTIONPARAMS -_OUTPUTAUDIOCONFIG.fields_by_name["audio_encoding"].enum_type = _OUTPUTAUDIOENCODING -_OUTPUTAUDIOCONFIG.fields_by_name[ - "synthesize_speech_config" -].message_type = _SYNTHESIZESPEECHCONFIG -DESCRIPTOR.message_types_by_name["SpeechContext"] = _SPEECHCONTEXT -DESCRIPTOR.message_types_by_name["SpeechWordInfo"] = _SPEECHWORDINFO -DESCRIPTOR.message_types_by_name["InputAudioConfig"] = _INPUTAUDIOCONFIG -DESCRIPTOR.message_types_by_name["VoiceSelectionParams"] = _VOICESELECTIONPARAMS -DESCRIPTOR.message_types_by_name["SynthesizeSpeechConfig"] = _SYNTHESIZESPEECHCONFIG -DESCRIPTOR.message_types_by_name["OutputAudioConfig"] = _OUTPUTAUDIOCONFIG -DESCRIPTOR.enum_types_by_name["AudioEncoding"] = _AUDIOENCODING -DESCRIPTOR.enum_types_by_name["SpeechModelVariant"] = _SPEECHMODELVARIANT -DESCRIPTOR.enum_types_by_name["SsmlVoiceGender"] = _SSMLVOICEGENDER -DESCRIPTOR.enum_types_by_name["OutputAudioEncoding"] = _OUTPUTAUDIOENCODING -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -SpeechContext = _reflection.GeneratedProtocolMessageType( - "SpeechContext", - (_message.Message,), - { - "DESCRIPTOR": _SPEECHCONTEXT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.audio_config_pb2", - "__doc__": """Hints for the speech recognizer to help with recognition in a specific - conversation state. - - Attributes: - phrases: - Optional. A list of strings containing words and phrases that - the speech recognizer should recognize with higher likelihood. - This list can be used to: - improve accuracy for words and - phrases you expect the user to say, e.g. typical commands - for your Dialogflow agent - add additional words to the - speech recognizer vocabulary - … See the `Cloud Speech - documentation `__ for usage limits. - boost: - Optional. Boost for this context compared to other contexts: - - If the boost is positive, Dialogflow will increase the - probability that the phrases in this context are recognized - over similar sounding phrases. - If the boost is - unspecified or non-positive, Dialogflow will not apply any - boost. Dialogflow recommends that you use boosts in the range - (0, 20] and that you find a value that fits your use case with - binary search. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.SpeechContext) - }, -) -_sym_db.RegisterMessage(SpeechContext) - -SpeechWordInfo = _reflection.GeneratedProtocolMessageType( - "SpeechWordInfo", - (_message.Message,), - { - "DESCRIPTOR": _SPEECHWORDINFO, - "__module__": "google.cloud.dialogflow_v2beta1.proto.audio_config_pb2", - "__doc__": """Information for a word recognized by the speech recognizer. - - Attributes: - word: - The word this info is for. - start_offset: - Time offset relative to the beginning of the audio that - corresponds to the start of the spoken word. This is an - experimental feature and the accuracy of the time offset can - vary. - end_offset: - Time offset relative to the beginning of the audio that - corresponds to the end of the spoken word. This is an - experimental feature and the accuracy of the time offset can - vary. - confidence: - The Speech confidence between 0.0 and 1.0 for this word. A - higher number indicates an estimated greater likelihood that - the recognized word is correct. The default of 0.0 is a - sentinel value indicating that confidence was not set. This - field is not guaranteed to be fully stable over time for the - same audio input. Users should also not rely on it to always - be provided. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.SpeechWordInfo) - }, -) -_sym_db.RegisterMessage(SpeechWordInfo) - -InputAudioConfig = _reflection.GeneratedProtocolMessageType( - "InputAudioConfig", - (_message.Message,), - { - "DESCRIPTOR": _INPUTAUDIOCONFIG, - "__module__": "google.cloud.dialogflow_v2beta1.proto.audio_config_pb2", - "__doc__": """Instructs the speech recognizer on how to process the audio content. - - Attributes: - audio_encoding: - Required. Audio encoding of the audio content to process. - sample_rate_hertz: - Required. Sample rate (in Hertz) of the audio content sent in - the query. Refer to `Cloud Speech API documentation - `__ for - more details. - language_code: - Required. The language of the supplied audio. Dialogflow does - not do translations. See `Language Support `__ for a list of - the currently supported language codes. Note that queries in - the same session do not necessarily need to specify the same - language. - enable_word_info: - If ``true``, Dialogflow returns [SpeechWordInfo][google.cloud. - dialogflow.v2beta1.SpeechWordInfo] in [StreamingRecognitionRes - ult][google.cloud.dialogflow.v2beta1.StreamingRecognitionResul - t] with information about the recognized speech words, - e.g. start and end time offsets. If false or unspecified, - Speech doesn’t return any word-level information. - phrase_hints: - A list of strings containing words and phrases that the speech - recognizer should recognize with higher likelihood. See `the - Cloud Speech documentation `__ for more details. This - field is deprecated. Please use `speech_contexts` - instead. If you specify both `phrase_hints` and - `speech_contexts`, Dialogflow will treat the - `phrase_hints` as a single additional `SpeechContext`. - speech_contexts: - Context information to assist speech recognition. See `the - Cloud Speech documentation `__ for more details. - model: - Which Speech model to select for the given request. Select the - model best suited to your domain to get best results. If a - model is not explicitly specified, then we auto-select a model - based on the parameters in the InputAudioConfig. If enhanced - speech model is enabled for the agent and an enhanced version - of the specified model for the language does not exist, then - the speech is recognized using the standard version of the - specified model. Refer to `Cloud Speech API documentation - `__ for more details. - model_variant: - Which variant of the [Speech - model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] - to use. - single_utterance: - If ``false`` (default), recognition does not cease until the - client closes the stream. If ``true``, the recognizer will - detect a single spoken utterance in input audio. Recognition - ceases when it detects the audio’s voice has stopped or - paused. In this case, once a detected intent is received, the - client should close the stream and start a new request with a - new stream as needed. Note: This setting is relevant only for - streaming methods. Note: When specified, - InputAudioConfig.single_utterance takes precedence over - StreamingDetectIntentRequest.single_utterance. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.InputAudioConfig) - }, -) -_sym_db.RegisterMessage(InputAudioConfig) - -VoiceSelectionParams = _reflection.GeneratedProtocolMessageType( - "VoiceSelectionParams", - (_message.Message,), - { - "DESCRIPTOR": _VOICESELECTIONPARAMS, - "__module__": "google.cloud.dialogflow_v2beta1.proto.audio_config_pb2", - "__doc__": """Description of which voice to use for speech synthesis. - - Attributes: - name: - Optional. The name of the voice. If not set, the service will - choose a voice based on the other parameters such as - language_code and [ssml_gender][google.cloud.dialogflow.v2beta - 1.VoiceSelectionParams.ssml_gender]. - ssml_gender: - Optional. The preferred gender of the voice. If not set, the - service will choose a voice based on the other parameters such - as language_code and [name][google.cloud.dialogflow.v2beta1.Vo - iceSelectionParams.name]. Note that this is only a preference, - not requirement. If a voice of the appropriate gender is not - available, the synthesizer should substitute a voice with a - different gender rather than failing the request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.VoiceSelectionParams) - }, -) -_sym_db.RegisterMessage(VoiceSelectionParams) - -SynthesizeSpeechConfig = _reflection.GeneratedProtocolMessageType( - "SynthesizeSpeechConfig", - (_message.Message,), - { - "DESCRIPTOR": _SYNTHESIZESPEECHCONFIG, - "__module__": "google.cloud.dialogflow_v2beta1.proto.audio_config_pb2", - "__doc__": """Configuration of how speech should be synthesized. - - Attributes: - speaking_rate: - Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 - is the normal native speed supported by the specific voice. - 2.0 is twice as fast, and 0.5 is half as fast. If unset(0.0), - defaults to the native 1.0 speed. Any other values < 0.25 or > - 4.0 will return an error. - pitch: - Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means - increase 20 semitones from the original pitch. -20 means - decrease 20 semitones from the original pitch. - volume_gain_db: - Optional. Volume gain (in dB) of the normal native volume - supported by the specific voice, in the range [-96.0, 16.0]. - If unset, or set to a value of 0.0 (dB), will play at normal - native signal amplitude. A value of -6.0 (dB) will play at - approximately half the amplitude of the normal native signal - amplitude. A value of +6.0 (dB) will play at approximately - twice the amplitude of the normal native signal amplitude. We - strongly recommend not to exceed +10 (dB) as there’s usually - no effective increase in loudness for any value greater than - that. - effects_profile_id: - Optional. An identifier which selects ‘audio effects’ profiles - that are applied on (post synthesized) text to speech. Effects - are applied on top of each other in the order they are given. - voice: - Optional. The desired voice of the synthesized audio. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig) - }, -) -_sym_db.RegisterMessage(SynthesizeSpeechConfig) - -OutputAudioConfig = _reflection.GeneratedProtocolMessageType( - "OutputAudioConfig", - (_message.Message,), - { - "DESCRIPTOR": _OUTPUTAUDIOCONFIG, - "__module__": "google.cloud.dialogflow_v2beta1.proto.audio_config_pb2", - "__doc__": """Instructs the speech synthesizer how to generate the output audio - content. If this audio config is supplied in a request, it overrides - all existing text-to-speech settings applied to the agent. - - Attributes: - audio_encoding: - Required. Audio encoding of the synthesized audio content. - sample_rate_hertz: - The synthesis sample rate (in hertz) for this audio. If not - provided, then the synthesizer will use the default sample - rate based on the audio encoding. If this is different from - the voice’s natural sample rate, then the synthesizer will - honor this request by converting to the desired sample rate - (which might result in worse audio quality). - synthesize_speech_config: - Configuration of how speech should be synthesized. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.OutputAudioConfig) - }, -) -_sym_db.RegisterMessage(OutputAudioConfig) - - -DESCRIPTOR._options = None -_INPUTAUDIOCONFIG.fields_by_name["phrase_hints"]._options = None -_OUTPUTAUDIOCONFIG.fields_by_name["audio_encoding"]._options = None -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/audio_config_pb2_grpc.py b/dialogflow_v2beta1/proto/audio_config_pb2_grpc.py deleted file mode 100644 index 8a9393943..000000000 --- a/dialogflow_v2beta1/proto/audio_config_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/dialogflow_v2beta1/proto/context_pb2.py b/dialogflow_v2beta1/proto/context_pb2.py deleted file mode 100644 index 0c952497b..000000000 --- a/dialogflow_v2beta1/proto/context_pb2.py +++ /dev/null @@ -1,838 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/context.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/context.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\014ContextProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n3google/cloud/dialogflow_v2beta1/proto/context.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/protobuf/struct.proto"\x83\x03\n\x07\x43ontext\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x16\n\x0elifespan_count\x18\x02 \x01(\x05\x12+\n\nparameters\x18\x03 \x01(\x0b\x32\x17.google.protobuf.Struct:\xa4\x02\xea\x41\xa0\x02\n!dialogflow.googleapis.com/Context\x12>projects/{project}/agent/sessions/{session}/contexts/{context}\x12\x66projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}\x12Sprojects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}"w\n\x13ListContextsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\x12!dialogflow.googleapis.com/Context\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"k\n\x14ListContextsResponse\x12:\n\x08\x63ontexts\x18\x01 \x03(\x0b\x32(.google.cloud.dialogflow.v2beta1.Context\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"L\n\x11GetContextRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!dialogflow.googleapis.com/Context"\x91\x01\n\x14\x43reateContextRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\x12!dialogflow.googleapis.com/Context\x12>\n\x07\x63ontext\x18\x02 \x01(\x0b\x32(.google.cloud.dialogflow.v2beta1.ContextB\x03\xe0\x41\x02"\x8c\x01\n\x14UpdateContextRequest\x12>\n\x07\x63ontext\x18\x01 \x01(\x0b\x32(.google.cloud.dialogflow.v2beta1.ContextB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01"O\n\x14\x44\x65leteContextRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!dialogflow.googleapis.com/Context"U\n\x18\x44\x65leteAllContextsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\x12!dialogflow.googleapis.com/Context2\x9c\x16\n\x08\x43ontexts\x12\xba\x03\n\x0cListContexts\x12\x34.google.cloud.dialogflow.v2beta1.ListContextsRequest\x1a\x35.google.cloud.dialogflow.v2beta1.ListContextsResponse"\xbc\x02\x82\xd3\xe4\x93\x02\xac\x02\x12\x36/v2beta1/{parent=projects/*/agent/sessions/*}/contextsZO\x12M/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contextsZD\x12\x42/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contextsZ[\x12Y/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts\xda\x41\x06parent\x12\xa7\x03\n\nGetContext\x12\x32.google.cloud.dialogflow.v2beta1.GetContextRequest\x1a(.google.cloud.dialogflow.v2beta1.Context"\xba\x02\x82\xd3\xe4\x93\x02\xac\x02\x12\x36/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}ZO\x12M/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}ZD\x12\x42/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}Z[\x12Y/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}\xda\x41\x04name\x12\xdb\x03\n\rCreateContext\x12\x35.google.cloud.dialogflow.v2beta1.CreateContextRequest\x1a(.google.cloud.dialogflow.v2beta1.Context"\xe8\x02\x82\xd3\xe4\x93\x02\xd0\x02"6/v2beta1/{parent=projects/*/agent/sessions/*}/contexts:\x07\x63ontextZX"M/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts:\x07\x63ontextZM"B/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts:\x07\x63ontextZd"Y/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts:\x07\x63ontext\xda\x41\x0eparent,context\x12\x8a\x04\n\rUpdateContext\x12\x35.google.cloud.dialogflow.v2beta1.UpdateContextRequest\x1a(.google.cloud.dialogflow.v2beta1.Context"\x97\x03\x82\xd3\xe4\x93\x02\xf0\x02\x32>/v2beta1/{context.name=projects/*/agent/sessions/*/contexts/*}:\x07\x63ontextZ`2U/v2beta1/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}:\x07\x63ontextZU2J/v2beta1/{context.name=projects/*/locations/*/agent/sessions/*/contexts/*}:\x07\x63ontextZl2a/v2beta1/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}:\x07\x63ontext\xda\x41\x13\x63ontext,update_mask\xda\x41\x07\x63ontext\x12\x9b\x03\n\rDeleteContext\x12\x35.google.cloud.dialogflow.v2beta1.DeleteContextRequest\x1a\x16.google.protobuf.Empty"\xba\x02\x82\xd3\xe4\x93\x02\xac\x02*6/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}ZO*M/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}ZD*B/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}Z[*Y/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}\xda\x41\x04name\x12\xa5\x03\n\x11\x44\x65leteAllContexts\x12\x39.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest\x1a\x16.google.protobuf.Empty"\xbc\x02\x82\xd3\xe4\x93\x02\xac\x02*6/v2beta1/{parent=projects/*/agent/sessions/*}/contextsZO*M/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contextsZD*B/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contextsZ[*Y/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts\xda\x41\x06parent\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\xaa\x01\n#com.google.cloud.dialogflow.v2beta1B\x0c\x43ontextProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, - ], -) - - -_CONTEXT = _descriptor.Descriptor( - name="Context", - full_name="google.cloud.dialogflow.v2beta1.Context", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.Context.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="lifespan_count", - full_name="google.cloud.dialogflow.v2beta1.Context.lifespan_count", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parameters", - full_name="google.cloud.dialogflow.v2beta1.Context.parameters", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"\352A\240\002\n!dialogflow.googleapis.com/Context\022>projects/{project}/agent/sessions/{session}/contexts/{context}\022fprojects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}\022Sprojects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=297, - serialized_end=684, -) - - -_LISTCONTEXTSREQUEST = _descriptor.Descriptor( - name="ListContextsRequest", - full_name="google.cloud.dialogflow.v2beta1.ListContextsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.ListContextsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\022!dialogflow.googleapis.com/Context", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2beta1.ListContextsRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2beta1.ListContextsRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=686, - serialized_end=805, -) - - -_LISTCONTEXTSRESPONSE = _descriptor.Descriptor( - name="ListContextsResponse", - full_name="google.cloud.dialogflow.v2beta1.ListContextsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="contexts", - full_name="google.cloud.dialogflow.v2beta1.ListContextsResponse.contexts", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2beta1.ListContextsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=807, - serialized_end=914, -) - - -_GETCONTEXTREQUEST = _descriptor.Descriptor( - name="GetContextRequest", - full_name="google.cloud.dialogflow.v2beta1.GetContextRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.GetContextRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\n!dialogflow.googleapis.com/Context", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=916, - serialized_end=992, -) - - -_CREATECONTEXTREQUEST = _descriptor.Descriptor( - name="CreateContextRequest", - full_name="google.cloud.dialogflow.v2beta1.CreateContextRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.CreateContextRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\022!dialogflow.googleapis.com/Context", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="context", - full_name="google.cloud.dialogflow.v2beta1.CreateContextRequest.context", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=995, - serialized_end=1140, -) - - -_UPDATECONTEXTREQUEST = _descriptor.Descriptor( - name="UpdateContextRequest", - full_name="google.cloud.dialogflow.v2beta1.UpdateContextRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="context", - full_name="google.cloud.dialogflow.v2beta1.UpdateContextRequest.context", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2beta1.UpdateContextRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1143, - serialized_end=1283, -) - - -_DELETECONTEXTREQUEST = _descriptor.Descriptor( - name="DeleteContextRequest", - full_name="google.cloud.dialogflow.v2beta1.DeleteContextRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.DeleteContextRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\n!dialogflow.googleapis.com/Context", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1285, - serialized_end=1364, -) - - -_DELETEALLCONTEXTSREQUEST = _descriptor.Descriptor( - name="DeleteAllContextsRequest", - full_name="google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\022!dialogflow.googleapis.com/Context", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1366, - serialized_end=1451, -) - -_CONTEXT.fields_by_name[ - "parameters" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_LISTCONTEXTSRESPONSE.fields_by_name["contexts"].message_type = _CONTEXT -_CREATECONTEXTREQUEST.fields_by_name["context"].message_type = _CONTEXT -_UPDATECONTEXTREQUEST.fields_by_name["context"].message_type = _CONTEXT -_UPDATECONTEXTREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -DESCRIPTOR.message_types_by_name["Context"] = _CONTEXT -DESCRIPTOR.message_types_by_name["ListContextsRequest"] = _LISTCONTEXTSREQUEST -DESCRIPTOR.message_types_by_name["ListContextsResponse"] = _LISTCONTEXTSRESPONSE -DESCRIPTOR.message_types_by_name["GetContextRequest"] = _GETCONTEXTREQUEST -DESCRIPTOR.message_types_by_name["CreateContextRequest"] = _CREATECONTEXTREQUEST -DESCRIPTOR.message_types_by_name["UpdateContextRequest"] = _UPDATECONTEXTREQUEST -DESCRIPTOR.message_types_by_name["DeleteContextRequest"] = _DELETECONTEXTREQUEST -DESCRIPTOR.message_types_by_name["DeleteAllContextsRequest"] = _DELETEALLCONTEXTSREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Context = _reflection.GeneratedProtocolMessageType( - "Context", - (_message.Message,), - { - "DESCRIPTOR": _CONTEXT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.context_pb2", - "__doc__": """Dialogflow contexts are similar to natural language context. If a - person says to you “they are orange”, you need context in order to - understand what “they” is referring to. Similarly, for Dialogflow to - handle an end-user expression like that, it needs to be provided with - context in order to correctly match an intent. Using contexts, you - can control the flow of a conversation. You can configure contexts for - an intent by setting input and output contexts, which are identified - by string names. When an intent is matched, any configured output - contexts for that intent become active. While any contexts are active, - Dialogflow is more likely to match intents that are configured with - input contexts that correspond to the currently active contexts. For - more information about context, see the `Contexts guide - `__. - - Attributes: - name: - Required. The unique identifier of the context. Format: - ``projects//agent/sessions//contexts/``, or ``projects//agent/environments//users//sessions//contexts/``. The - ``Context ID`` is always converted to lowercase, may only - contain characters in a-zA-Z0-9_-% and may be at most 250 - bytes long. If ``Environment ID`` is not specified, we assume - default ‘draft’ environment. If ``User ID`` is not specified, - we assume default ‘-’ user. The following context names are - reserved for internal use by Dialogflow. You should not use - these contexts or create contexts with these names: - - ``__system_counters__`` - ``*_id_dialog_context`` - - ``*_dialog_params_size`` - lifespan_count: - Optional. The number of conversational query requests after - which the context expires. The default is ``0``. If set to - ``0``, the context expires immediately. Contexts expire - automatically after 20 minutes if there are no matching - queries. - parameters: - Optional. The collection of parameters associated with this - context. 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: string or - number, depending on parameter value type - MapValue value: - - If parameter’s entity type is a composite entity: map from - composite entity property names to property values - Else: - parameter value - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Context) - }, -) -_sym_db.RegisterMessage(Context) - -ListContextsRequest = _reflection.GeneratedProtocolMessageType( - "ListContextsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTCONTEXTSREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.context_pb2", - "__doc__": """The request message for [Contexts.ListContexts][google.cloud.dialogflo - w.v2beta1.Contexts.ListContexts]. - - Attributes: - parent: - Required. The session to list all contexts from. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users//sessions/``. If ``Environment - ID`` is not specified, we assume default ‘draft’ environment. - If ``User ID`` is not specified, we assume default ‘-’ user. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListContextsRequest) - }, -) -_sym_db.RegisterMessage(ListContextsRequest) - -ListContextsResponse = _reflection.GeneratedProtocolMessageType( - "ListContextsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTCONTEXTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.context_pb2", - "__doc__": """The response message for [Contexts.ListContexts][google.cloud.dialogfl - ow.v2beta1.Contexts.ListContexts]. - - Attributes: - contexts: - The list of contexts. There will be a maximum number of items - returned based on the page_size field in the request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListContextsResponse) - }, -) -_sym_db.RegisterMessage(ListContextsResponse) - -GetContextRequest = _reflection.GeneratedProtocolMessageType( - "GetContextRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETCONTEXTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.context_pb2", - "__doc__": """The request message for [Contexts.GetContext][google.cloud.dialogflow. - v2beta1.Contexts.GetContext]. - - Attributes: - name: - Required. The name of the context. Format: ``projects//agent/sessions//contexts/`` or - ``projects//agent/environments//users//sessions//contexts/``. If ``Environment ID`` is not specified, we assume - default ‘draft’ environment. If ``User ID`` is not specified, - we assume default ‘-’ user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.GetContextRequest) - }, -) -_sym_db.RegisterMessage(GetContextRequest) - -CreateContextRequest = _reflection.GeneratedProtocolMessageType( - "CreateContextRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATECONTEXTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.context_pb2", - "__doc__": """The request message for [Contexts.CreateContext][google.cloud.dialogfl - ow.v2beta1.Contexts.CreateContext]. - - Attributes: - parent: - Required. The session to create a context for. Format: - ``projects//agent/sessions/`` or - ``projects//agent/environments//users//sessions/``. If ``Environment - ID`` is not specified, we assume default ‘draft’ environment. - If ``User ID`` is not specified, we assume default ‘-’ user. - context: - Required. The context to create. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.CreateContextRequest) - }, -) -_sym_db.RegisterMessage(CreateContextRequest) - -UpdateContextRequest = _reflection.GeneratedProtocolMessageType( - "UpdateContextRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATECONTEXTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.context_pb2", - "__doc__": """The request message for [Contexts.UpdateContext][google.cloud.dialogfl - ow.v2beta1.Contexts.UpdateContext]. - - Attributes: - context: - Required. The context to update. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.UpdateContextRequest) - }, -) -_sym_db.RegisterMessage(UpdateContextRequest) - -DeleteContextRequest = _reflection.GeneratedProtocolMessageType( - "DeleteContextRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETECONTEXTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.context_pb2", - "__doc__": """The request message for [Contexts.DeleteContext][google.cloud.dialogfl - ow.v2beta1.Contexts.DeleteContext]. - - Attributes: - name: - Required. The name of the context to delete. Format: - ``projects//agent/sessions//contexts/`` or ``projects//agent/environments//users//sessions//contexts/``. If - ``Environment ID`` is not specified, we assume default ‘draft’ - environment. If ``User ID`` is not specified, we assume - default ‘-’ user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.DeleteContextRequest) - }, -) -_sym_db.RegisterMessage(DeleteContextRequest) - -DeleteAllContextsRequest = _reflection.GeneratedProtocolMessageType( - "DeleteAllContextsRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEALLCONTEXTSREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.context_pb2", - "__doc__": """The request message for [Contexts.DeleteAllContexts][google.cloud.dial - ogflow.v2beta1.Contexts.DeleteAllContexts]. - - Attributes: - parent: - Required. The name of the session to delete all contexts from. - Format: ``projects//agent/sessions/`` - or ``projects//agent/environments//users//sessions/``. If ``Environment - ID`` is not specified we assume default ‘draft’ environment. - If ``User ID`` is not specified, we assume default ‘-’ user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest) - }, -) -_sym_db.RegisterMessage(DeleteAllContextsRequest) - - -DESCRIPTOR._options = None -_CONTEXT._options = None -_LISTCONTEXTSREQUEST.fields_by_name["parent"]._options = None -_GETCONTEXTREQUEST.fields_by_name["name"]._options = None -_CREATECONTEXTREQUEST.fields_by_name["parent"]._options = None -_CREATECONTEXTREQUEST.fields_by_name["context"]._options = None -_UPDATECONTEXTREQUEST.fields_by_name["context"]._options = None -_UPDATECONTEXTREQUEST.fields_by_name["update_mask"]._options = None -_DELETECONTEXTREQUEST.fields_by_name["name"]._options = None -_DELETEALLCONTEXTSREQUEST.fields_by_name["parent"]._options = None - -_CONTEXTS = _descriptor.ServiceDescriptor( - name="Contexts", - full_name="google.cloud.dialogflow.v2beta1.Contexts", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=1454, - serialized_end=4298, - methods=[ - _descriptor.MethodDescriptor( - name="ListContexts", - full_name="google.cloud.dialogflow.v2beta1.Contexts.ListContexts", - index=0, - containing_service=None, - input_type=_LISTCONTEXTSREQUEST, - output_type=_LISTCONTEXTSRESPONSE, - serialized_options=b"\202\323\344\223\002\254\002\0226/v2beta1/{parent=projects/*/agent/sessions/*}/contextsZO\022M/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contextsZD\022B/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contextsZ[\022Y/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetContext", - full_name="google.cloud.dialogflow.v2beta1.Contexts.GetContext", - index=1, - containing_service=None, - input_type=_GETCONTEXTREQUEST, - output_type=_CONTEXT, - serialized_options=b"\202\323\344\223\002\254\002\0226/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}ZO\022M/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}ZD\022B/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}Z[\022Y/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateContext", - full_name="google.cloud.dialogflow.v2beta1.Contexts.CreateContext", - index=2, - containing_service=None, - input_type=_CREATECONTEXTREQUEST, - output_type=_CONTEXT, - serialized_options=b'\202\323\344\223\002\320\002"6/v2beta1/{parent=projects/*/agent/sessions/*}/contexts:\007contextZX"M/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts:\007contextZM"B/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts:\007contextZd"Y/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts:\007context\332A\016parent,context', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateContext", - full_name="google.cloud.dialogflow.v2beta1.Contexts.UpdateContext", - index=3, - containing_service=None, - input_type=_UPDATECONTEXTREQUEST, - output_type=_CONTEXT, - serialized_options=b"\202\323\344\223\002\360\0022>/v2beta1/{context.name=projects/*/agent/sessions/*/contexts/*}:\007contextZ`2U/v2beta1/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}:\007contextZU2J/v2beta1/{context.name=projects/*/locations/*/agent/sessions/*/contexts/*}:\007contextZl2a/v2beta1/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}:\007context\332A\023context,update_mask\332A\007context", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteContext", - full_name="google.cloud.dialogflow.v2beta1.Contexts.DeleteContext", - index=4, - containing_service=None, - input_type=_DELETECONTEXTREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002\254\002*6/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}ZO*M/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}ZD*B/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}Z[*Y/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteAllContexts", - full_name="google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts", - index=5, - containing_service=None, - input_type=_DELETEALLCONTEXTSREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002\254\002*6/v2beta1/{parent=projects/*/agent/sessions/*}/contextsZO*M/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contextsZD*B/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contextsZ[*Y/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_CONTEXTS) - -DESCRIPTOR.services_by_name["Contexts"] = _CONTEXTS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/context_pb2_grpc.py b/dialogflow_v2beta1/proto/context_pb2_grpc.py deleted file mode 100644 index 154bd4c1e..000000000 --- a/dialogflow_v2beta1/proto/context_pb2_grpc.py +++ /dev/null @@ -1,306 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2beta1.proto import ( - context_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class ContextsStub(object): - """Service for managing [Contexts][google.cloud.dialogflow.v2beta1.Context]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListContexts = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Contexts/ListContexts", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.ListContextsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.ListContextsResponse.FromString, - ) - self.GetContext = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Contexts/GetContext", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.GetContextRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.Context.FromString, - ) - self.CreateContext = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Contexts/CreateContext", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.CreateContextRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.Context.FromString, - ) - self.UpdateContext = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Contexts/UpdateContext", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.UpdateContextRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.Context.FromString, - ) - self.DeleteContext = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Contexts/DeleteContext", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.DeleteContextRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.DeleteAllContexts = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Contexts/DeleteAllContexts", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.DeleteAllContextsRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - - -class ContextsServicer(object): - """Service for managing [Contexts][google.cloud.dialogflow.v2beta1.Context]. - """ - - def ListContexts(self, request, context): - """Returns the list of all contexts in the specified session. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetContext(self, request, context): - """Retrieves the specified context. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateContext(self, request, context): - """Creates a context. - - If the specified context already exists, overrides the context. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateContext(self, request, context): - """Updates the specified context. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteContext(self, request, context): - """Deletes the specified context. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteAllContexts(self, request, context): - """Deletes all active contexts in the specified session. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_ContextsServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListContexts": grpc.unary_unary_rpc_method_handler( - servicer.ListContexts, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.ListContextsRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.ListContextsResponse.SerializeToString, - ), - "GetContext": grpc.unary_unary_rpc_method_handler( - servicer.GetContext, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.GetContextRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.Context.SerializeToString, - ), - "CreateContext": grpc.unary_unary_rpc_method_handler( - servicer.CreateContext, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.CreateContextRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.Context.SerializeToString, - ), - "UpdateContext": grpc.unary_unary_rpc_method_handler( - servicer.UpdateContext, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.UpdateContextRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.Context.SerializeToString, - ), - "DeleteContext": grpc.unary_unary_rpc_method_handler( - servicer.DeleteContext, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.DeleteContextRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "DeleteAllContexts": grpc.unary_unary_rpc_method_handler( - servicer.DeleteAllContexts, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.DeleteAllContextsRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2beta1.Contexts", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Contexts(object): - """Service for managing [Contexts][google.cloud.dialogflow.v2beta1.Context]. - """ - - @staticmethod - def ListContexts( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Contexts/ListContexts", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.ListContextsRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.ListContextsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetContext( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Contexts/GetContext", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.GetContextRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.Context.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateContext( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Contexts/CreateContext", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.CreateContextRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.Context.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateContext( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Contexts/UpdateContext", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.UpdateContextRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.Context.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteContext( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Contexts/DeleteContext", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.DeleteContextRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteAllContexts( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Contexts/DeleteAllContexts", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.DeleteAllContextsRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2beta1/proto/document_pb2.py b/dialogflow_v2beta1/proto/document_pb2.py deleted file mode 100644 index 70850bac8..000000000 --- a/dialogflow_v2beta1/proto/document_pb2.py +++ /dev/null @@ -1,1376 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/document.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from dialogflow_v2beta1.proto import ( - gcs_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_gcs__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from google.rpc import status_pb2 as google_dot_rpc_dot_status__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/document.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\rDocumentProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n4google/cloud/dialogflow_v2beta1/proto/document.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a/google/cloud/dialogflow_v2beta1/proto/gcs.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto"\x8f\x05\n\x08\x44ocument\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12U\n\x0fknowledge_types\x18\x04 \x03(\x0e\x32\x37.google.cloud.dialogflow.v2beta1.Document.KnowledgeTypeB\x03\xe0\x41\x02\x12\x15\n\x0b\x63ontent_uri\x18\x05 \x01(\tH\x00\x12\x15\n\x07\x63ontent\x18\x06 \x01(\tB\x02\x18\x01H\x00\x12\x15\n\x0braw_content\x18\t \x01(\x0cH\x00\x12\x1f\n\x12\x65nable_auto_reload\x18\x0b \x01(\x08\x42\x03\xe0\x41\x01\x12Y\n\x14latest_reload_status\x18\x0c \x01(\x0b\x32\x36.google.cloud.dialogflow.v2beta1.Document.ReloadStatusB\x03\xe0\x41\x03\x1a\\\n\x0cReloadStatus\x12(\n\x04time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12"\n\x06status\x18\x02 \x01(\x0b\x32\x12.google.rpc.Status"K\n\rKnowledgeType\x12\x1e\n\x1aKNOWLEDGE_TYPE_UNSPECIFIED\x10\x00\x12\x07\n\x03\x46\x41Q\x10\x01\x12\x11\n\rEXTRACTIVE_QA\x10\x02:p\xea\x41m\n"dialogflow.googleapis.com/Document\x12Gprojects/{project}/knowledgeBases/{knowledge_base}/documents/{document}B\x08\n\x06source"N\n\x12GetDocumentRequest\x12\x38\n\x04name\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"dialogflow.googleapis.com/Document"y\n\x14ListDocumentsRequest\x12:\n\x06parent\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\x12"dialogflow.googleapis.com/Document\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"n\n\x15ListDocumentsResponse\x12<\n\tdocuments\x18\x01 \x03(\x0b\x32).google.cloud.dialogflow.v2beta1.Document\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\x95\x01\n\x15\x43reateDocumentRequest\x12:\n\x06parent\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\x12"dialogflow.googleapis.com/Document\x12@\n\x08\x64ocument\x18\x02 \x01(\x0b\x32).google.cloud.dialogflow.v2beta1.DocumentB\x03\xe0\x41\x02"Q\n\x15\x44\x65leteDocumentRequest\x12\x38\n\x04name\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"dialogflow.googleapis.com/Document"\x8f\x01\n\x15UpdateDocumentRequest\x12@\n\x08\x64ocument\x18\x01 \x01(\x0b\x32).google.cloud.dialogflow.v2beta1.DocumentB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01"\xb7\x01\n\x1aKnowledgeOperationMetadata\x12U\n\x05state\x18\x01 \x01(\x0e\x32\x41.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.StateB\x03\xe0\x41\x03"B\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07PENDING\x10\x01\x12\x0b\n\x07RUNNING\x10\x02\x12\x08\n\x04\x44ONE\x10\x03"\x9d\x01\n\x15ReloadDocumentRequest\x12\x38\n\x04name\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"dialogflow.googleapis.com/Document\x12@\n\ngcs_source\x18\x03 \x01(\x0b\x32*.google.cloud.dialogflow.v2beta1.GcsSourceH\x00\x42\x08\n\x06source"s\n(AutoApproveSmartMessagingEntriesResponse\x12\x15\n\renabled_count\x18\x01 \x01(\x05\x12\x16\n\x0e\x64isabled_count\x18\x02 \x01(\x05\x12\x18\n\x10unreviewed_count\x18\x03 \x01(\x05\x32\xfd\x0e\n\tDocuments\x12\x8a\x02\n\rListDocuments\x12\x35.google.cloud.dialogflow.v2beta1.ListDocumentsRequest\x1a\x36.google.cloud.dialogflow.v2beta1.ListDocumentsResponse"\x89\x01\x82\xd3\xe4\x93\x02z\x12\x37/v2beta1/{parent=projects/*/knowledgeBases/*}/documentsZ?\x12=/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents\xda\x41\x06parent\x12\xf7\x01\n\x0bGetDocument\x12\x33.google.cloud.dialogflow.v2beta1.GetDocumentRequest\x1a).google.cloud.dialogflow.v2beta1.Document"\x87\x01\x82\xd3\xe4\x93\x02z\x12\x37/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}Z?\x12=/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}\xda\x41\x04name\x12\xba\x02\n\x0e\x43reateDocument\x12\x36.google.cloud.dialogflow.v2beta1.CreateDocumentRequest\x1a\x1d.google.longrunning.Operation"\xd0\x01\x82\xd3\xe4\x93\x02\x8e\x01"7/v2beta1/{parent=projects/*/knowledgeBases/*}/documents:\x08\x64ocumentZI"=/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents:\x08\x64ocument\xda\x41\x0fparent,document\xca\x41&\n\x08\x44ocument\x12\x1aKnowledgeOperationMetadata\x12\xa7\x02\n\x0e\x44\x65leteDocument\x12\x36.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest\x1a\x1d.google.longrunning.Operation"\xbd\x01\x82\xd3\xe4\x93\x02z*7/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}Z?*=/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}\xda\x41\x04name\xca\x41\x33\n\x15google.protobuf.Empty\x12\x1aKnowledgeOperationMetadata\x12\xdc\x02\n\x0eUpdateDocument\x12\x36.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest\x1a\x1d.google.longrunning.Operation"\xf2\x01\x82\xd3\xe4\x93\x02\xa0\x01\x32@/v2beta1/{document.name=projects/*/knowledgeBases/*/documents/*}:\x08\x64ocumentZR2F/v2beta1/{document.name=projects/*/agent/knowledgeBases/*/documents/*}:\x08\x64ocument\xda\x41\x14\x64ocument,update_mask\xda\x41\x08\x64ocument\xca\x41&\n\x08\x44ocument\x12\x1aKnowledgeOperationMetadata\x12\xa8\x02\n\x0eReloadDocument\x12\x36.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest\x1a\x1d.google.longrunning.Operation"\xbe\x01\x82\xd3\xe4\x93\x02\x8e\x01">/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}:reload:\x01*ZI"D/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload:\x01*\xca\x41&\n\x08\x44ocument\x12\x1aKnowledgeOperationMetadata\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\xab\x01\n#com.google.cloud.dialogflow.v2beta1B\rDocumentProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_gcs__pb2.DESCRIPTOR, - google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - google_dot_rpc_dot_status__pb2.DESCRIPTOR, - ], -) - - -_DOCUMENT_KNOWLEDGETYPE = _descriptor.EnumDescriptor( - name="KnowledgeType", - full_name="google.cloud.dialogflow.v2beta1.Document.KnowledgeType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="KNOWLEDGE_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FAQ", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EXTRACTIVE_QA", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=868, - serialized_end=943, -) -_sym_db.RegisterEnumDescriptor(_DOCUMENT_KNOWLEDGETYPE) - -_KNOWLEDGEOPERATIONMETADATA_STATE = _descriptor.EnumDescriptor( - name="State", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="STATE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PENDING", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="RUNNING", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="DONE", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1883, - serialized_end=1949, -) -_sym_db.RegisterEnumDescriptor(_KNOWLEDGEOPERATIONMETADATA_STATE) - - -_DOCUMENT_RELOADSTATUS = _descriptor.Descriptor( - name="ReloadStatus", - full_name="google.cloud.dialogflow.v2beta1.Document.ReloadStatus", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="time", - full_name="google.cloud.dialogflow.v2beta1.Document.ReloadStatus.time", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="status", - full_name="google.cloud.dialogflow.v2beta1.Document.ReloadStatus.status", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=774, - serialized_end=866, -) - -_DOCUMENT = _descriptor.Descriptor( - name="Document", - full_name="google.cloud.dialogflow.v2beta1.Document", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.Document.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.dialogflow.v2beta1.Document.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="mime_type", - full_name="google.cloud.dialogflow.v2beta1.Document.mime_type", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="knowledge_types", - full_name="google.cloud.dialogflow.v2beta1.Document.knowledge_types", - index=3, - number=4, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="content_uri", - full_name="google.cloud.dialogflow.v2beta1.Document.content_uri", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="content", - full_name="google.cloud.dialogflow.v2beta1.Document.content", - index=5, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\030\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="raw_content", - full_name="google.cloud.dialogflow.v2beta1.Document.raw_content", - index=6, - number=9, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="enable_auto_reload", - full_name="google.cloud.dialogflow.v2beta1.Document.enable_auto_reload", - index=7, - number=11, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="latest_reload_status", - full_name="google.cloud.dialogflow.v2beta1.Document.latest_reload_status", - index=8, - number=12, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_DOCUMENT_RELOADSTATUS], - enum_types=[_DOCUMENT_KNOWLEDGETYPE], - serialized_options=b'\352Am\n"dialogflow.googleapis.com/Document\022Gprojects/{project}/knowledgeBases/{knowledge_base}/documents/{document}', - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="source", - full_name="google.cloud.dialogflow.v2beta1.Document.source", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=412, - serialized_end=1067, -) - - -_GETDOCUMENTREQUEST = _descriptor.Descriptor( - name="GetDocumentRequest", - full_name="google.cloud.dialogflow.v2beta1.GetDocumentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.GetDocumentRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A$\n"dialogflow.googleapis.com/Document', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1069, - serialized_end=1147, -) - - -_LISTDOCUMENTSREQUEST = _descriptor.Descriptor( - name="ListDocumentsRequest", - full_name="google.cloud.dialogflow.v2beta1.ListDocumentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.ListDocumentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A$\022"dialogflow.googleapis.com/Document', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2beta1.ListDocumentsRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2beta1.ListDocumentsRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1149, - serialized_end=1270, -) - - -_LISTDOCUMENTSRESPONSE = _descriptor.Descriptor( - name="ListDocumentsResponse", - full_name="google.cloud.dialogflow.v2beta1.ListDocumentsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="documents", - full_name="google.cloud.dialogflow.v2beta1.ListDocumentsResponse.documents", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2beta1.ListDocumentsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1272, - serialized_end=1382, -) - - -_CREATEDOCUMENTREQUEST = _descriptor.Descriptor( - name="CreateDocumentRequest", - full_name="google.cloud.dialogflow.v2beta1.CreateDocumentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.CreateDocumentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A$\022"dialogflow.googleapis.com/Document', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="document", - full_name="google.cloud.dialogflow.v2beta1.CreateDocumentRequest.document", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1385, - serialized_end=1534, -) - - -_DELETEDOCUMENTREQUEST = _descriptor.Descriptor( - name="DeleteDocumentRequest", - full_name="google.cloud.dialogflow.v2beta1.DeleteDocumentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.DeleteDocumentRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A$\n"dialogflow.googleapis.com/Document', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1536, - serialized_end=1617, -) - - -_UPDATEDOCUMENTREQUEST = _descriptor.Descriptor( - name="UpdateDocumentRequest", - full_name="google.cloud.dialogflow.v2beta1.UpdateDocumentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="document", - full_name="google.cloud.dialogflow.v2beta1.UpdateDocumentRequest.document", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2beta1.UpdateDocumentRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1620, - serialized_end=1763, -) - - -_KNOWLEDGEOPERATIONMETADATA = _descriptor.Descriptor( - name="KnowledgeOperationMetadata", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="state", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.state", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[_KNOWLEDGEOPERATIONMETADATA_STATE], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1766, - serialized_end=1949, -) - - -_RELOADDOCUMENTREQUEST = _descriptor.Descriptor( - name="ReloadDocumentRequest", - full_name="google.cloud.dialogflow.v2beta1.ReloadDocumentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.ReloadDocumentRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A$\n"dialogflow.googleapis.com/Document', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="gcs_source", - full_name="google.cloud.dialogflow.v2beta1.ReloadDocumentRequest.gcs_source", - index=1, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="source", - full_name="google.cloud.dialogflow.v2beta1.ReloadDocumentRequest.source", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=1952, - serialized_end=2109, -) - - -_AUTOAPPROVESMARTMESSAGINGENTRIESRESPONSE = _descriptor.Descriptor( - name="AutoApproveSmartMessagingEntriesResponse", - full_name="google.cloud.dialogflow.v2beta1.AutoApproveSmartMessagingEntriesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="enabled_count", - full_name="google.cloud.dialogflow.v2beta1.AutoApproveSmartMessagingEntriesResponse.enabled_count", - index=0, - number=1, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="disabled_count", - full_name="google.cloud.dialogflow.v2beta1.AutoApproveSmartMessagingEntriesResponse.disabled_count", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="unreviewed_count", - full_name="google.cloud.dialogflow.v2beta1.AutoApproveSmartMessagingEntriesResponse.unreviewed_count", - index=2, - number=3, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2111, - serialized_end=2226, -) - -_DOCUMENT_RELOADSTATUS.fields_by_name[ - "time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_DOCUMENT_RELOADSTATUS.fields_by_name[ - "status" -].message_type = google_dot_rpc_dot_status__pb2._STATUS -_DOCUMENT_RELOADSTATUS.containing_type = _DOCUMENT -_DOCUMENT.fields_by_name["knowledge_types"].enum_type = _DOCUMENT_KNOWLEDGETYPE -_DOCUMENT.fields_by_name["latest_reload_status"].message_type = _DOCUMENT_RELOADSTATUS -_DOCUMENT_KNOWLEDGETYPE.containing_type = _DOCUMENT -_DOCUMENT.oneofs_by_name["source"].fields.append( - _DOCUMENT.fields_by_name["content_uri"] -) -_DOCUMENT.fields_by_name["content_uri"].containing_oneof = _DOCUMENT.oneofs_by_name[ - "source" -] -_DOCUMENT.oneofs_by_name["source"].fields.append(_DOCUMENT.fields_by_name["content"]) -_DOCUMENT.fields_by_name["content"].containing_oneof = _DOCUMENT.oneofs_by_name[ - "source" -] -_DOCUMENT.oneofs_by_name["source"].fields.append( - _DOCUMENT.fields_by_name["raw_content"] -) -_DOCUMENT.fields_by_name["raw_content"].containing_oneof = _DOCUMENT.oneofs_by_name[ - "source" -] -_LISTDOCUMENTSRESPONSE.fields_by_name["documents"].message_type = _DOCUMENT -_CREATEDOCUMENTREQUEST.fields_by_name["document"].message_type = _DOCUMENT -_UPDATEDOCUMENTREQUEST.fields_by_name["document"].message_type = _DOCUMENT -_UPDATEDOCUMENTREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_KNOWLEDGEOPERATIONMETADATA.fields_by_name[ - "state" -].enum_type = _KNOWLEDGEOPERATIONMETADATA_STATE -_KNOWLEDGEOPERATIONMETADATA_STATE.containing_type = _KNOWLEDGEOPERATIONMETADATA -_RELOADDOCUMENTREQUEST.fields_by_name[ - "gcs_source" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_gcs__pb2._GCSSOURCE -) -_RELOADDOCUMENTREQUEST.oneofs_by_name["source"].fields.append( - _RELOADDOCUMENTREQUEST.fields_by_name["gcs_source"] -) -_RELOADDOCUMENTREQUEST.fields_by_name[ - "gcs_source" -].containing_oneof = _RELOADDOCUMENTREQUEST.oneofs_by_name["source"] -DESCRIPTOR.message_types_by_name["Document"] = _DOCUMENT -DESCRIPTOR.message_types_by_name["GetDocumentRequest"] = _GETDOCUMENTREQUEST -DESCRIPTOR.message_types_by_name["ListDocumentsRequest"] = _LISTDOCUMENTSREQUEST -DESCRIPTOR.message_types_by_name["ListDocumentsResponse"] = _LISTDOCUMENTSRESPONSE -DESCRIPTOR.message_types_by_name["CreateDocumentRequest"] = _CREATEDOCUMENTREQUEST -DESCRIPTOR.message_types_by_name["DeleteDocumentRequest"] = _DELETEDOCUMENTREQUEST -DESCRIPTOR.message_types_by_name["UpdateDocumentRequest"] = _UPDATEDOCUMENTREQUEST -DESCRIPTOR.message_types_by_name[ - "KnowledgeOperationMetadata" -] = _KNOWLEDGEOPERATIONMETADATA -DESCRIPTOR.message_types_by_name["ReloadDocumentRequest"] = _RELOADDOCUMENTREQUEST -DESCRIPTOR.message_types_by_name[ - "AutoApproveSmartMessagingEntriesResponse" -] = _AUTOAPPROVESMARTMESSAGINGENTRIESRESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Document = _reflection.GeneratedProtocolMessageType( - "Document", - (_message.Message,), - { - "ReloadStatus": _reflection.GeneratedProtocolMessageType( - "ReloadStatus", - (_message.Message,), - { - "DESCRIPTOR": _DOCUMENT_RELOADSTATUS, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """The status of a reload attempt. - - Attributes: - time: - Output only. The time of a reload attempt. This reload may - have been triggered automatically or manually and may not have - succeeded. - status: - Output only. The status of a reload attempt or the initial - load. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Document.ReloadStatus) - }, - ), - "DESCRIPTOR": _DOCUMENT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """A knowledge document to be used by a - [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. For - more information, see the `knowledge base guide - `__. - Note: The ``projects.agent.knowledgeBases.documents`` resource is - deprecated; only use ``projects.knowledgeBases.documents``. - - Attributes: - name: - Optional. The document resource name. The name must be empty - when creating a document. Format: ``projects//knowledgeBases//documents/``. - display_name: - Required. The display name of the document. The name must be - 1024 bytes or less; otherwise, the creation request fails. - mime_type: - Required. The MIME type of this document. - knowledge_types: - Required. The knowledge type of document content. - source: - The source of this document. - content_uri: - The URI where the file content is located. For documents - stored in Google Cloud Storage, these URIs must have the form - ``gs:///``. NOTE: External URLs - must correspond to public webpages, i.e., they must be indexed - by Google Search. In particular, URLs for showing documents in - Google Cloud Storage (i.e. the URL in your browser) are not - supported. Instead use the ``gs://`` format URI described - above. - content: - The raw content of the document. This field is only permitted - for EXTRACTIVE_QA and FAQ knowledge types. Note: This field is - in the process of being deprecated, please use raw_content - instead. - raw_content: - The raw content of the document. This field is only permitted - for EXTRACTIVE_QA and FAQ knowledge types. - enable_auto_reload: - Optional. If true, we try to automatically reload the document - every day (at a time picked by the system). If false or - unspecified, we don’t try to automatically reload the - document. Currently you can only enable automatic reload for - documents sourced from a public url, see ``source`` field for - the source types. Reload status can be tracked in - ``latest_reload_status``. If a reload fails, we will keep the - document unchanged. If a reload fails with internal errors, - the system will try to reload the document on the next day. If - a reload fails with non-retriable errors - (e.g. PERMISION_DENIED), the system will not try to reload the - document anymore. You need to manually reload the document - successfully by calling ``ReloadDocument`` and clear the - errors. - latest_reload_status: - Output only. The time and status of the latest reload. This - reload may have been triggered automatically or manually and - may not have succeeded. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Document) - }, -) -_sym_db.RegisterMessage(Document) -_sym_db.RegisterMessage(Document.ReloadStatus) - -GetDocumentRequest = _reflection.GeneratedProtocolMessageType( - "GetDocumentRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETDOCUMENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """Request message for [Documents.GetDocument][google.cloud.dialogflow.v2 - beta1.Documents.GetDocument]. - - Attributes: - name: - Required. The name of the document to retrieve. Format - ``projects//knowledgeBases//documents/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.GetDocumentRequest) - }, -) -_sym_db.RegisterMessage(GetDocumentRequest) - -ListDocumentsRequest = _reflection.GeneratedProtocolMessageType( - "ListDocumentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTDOCUMENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """Request message for [Documents.ListDocuments][google.cloud.dialogflow. - v2beta1.Documents.ListDocuments]. - - Attributes: - parent: - Required. The knowledge base to list all documents for. - Format: ``projects//knowledgeBases/``. - page_size: - The maximum number of items to return in a single page. By - default 10 and at most 100. - page_token: - The next_page_token value returned from a previous list - request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListDocumentsRequest) - }, -) -_sym_db.RegisterMessage(ListDocumentsRequest) - -ListDocumentsResponse = _reflection.GeneratedProtocolMessageType( - "ListDocumentsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTDOCUMENTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """Response message for [Documents.ListDocuments][google.cloud.dialogflow - .v2beta1.Documents.ListDocuments]. - - Attributes: - documents: - The list of documents. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListDocumentsResponse) - }, -) -_sym_db.RegisterMessage(ListDocumentsResponse) - -CreateDocumentRequest = _reflection.GeneratedProtocolMessageType( - "CreateDocumentRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEDOCUMENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """Request message for [Documents.CreateDocument][google.cloud.dialogflow - .v2beta1.Documents.CreateDocument]. - - Attributes: - parent: - Required. The knoweldge base to create a document for. Format: - ``projects//knowledgeBases/``. - document: - Required. The document to create. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.CreateDocumentRequest) - }, -) -_sym_db.RegisterMessage(CreateDocumentRequest) - -DeleteDocumentRequest = _reflection.GeneratedProtocolMessageType( - "DeleteDocumentRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEDOCUMENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """Request message for [Documents.DeleteDocument][google.cloud.dialogflow - .v2beta1.Documents.DeleteDocument]. - - Attributes: - name: - Required. The name of the document to delete. Format: - ``projects//knowledgeBases//documents/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.DeleteDocumentRequest) - }, -) -_sym_db.RegisterMessage(DeleteDocumentRequest) - -UpdateDocumentRequest = _reflection.GeneratedProtocolMessageType( - "UpdateDocumentRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEDOCUMENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """Request message for [Documents.UpdateDocument][google.cloud.dialogflow - .v2beta1.Documents.UpdateDocument]. - - Attributes: - document: - Required. The document to update. - update_mask: - Optional. Not specified means ``update all``. Currently, only - ``display_name`` can be updated, an InvalidArgument will be - returned for attempting to update other fields. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.UpdateDocumentRequest) - }, -) -_sym_db.RegisterMessage(UpdateDocumentRequest) - -KnowledgeOperationMetadata = _reflection.GeneratedProtocolMessageType( - "KnowledgeOperationMetadata", - (_message.Message,), - { - "DESCRIPTOR": _KNOWLEDGEOPERATIONMETADATA, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """Metadata in google::longrunning::Operation for Knowledge operations. - - Attributes: - state: - Required. Output only. The current state of this operation. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata) - }, -) -_sym_db.RegisterMessage(KnowledgeOperationMetadata) - -ReloadDocumentRequest = _reflection.GeneratedProtocolMessageType( - "ReloadDocumentRequest", - (_message.Message,), - { - "DESCRIPTOR": _RELOADDOCUMENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """Request message for [Documents.ReloadDocument][google.cloud.dialogflow - .v2beta1.Documents.ReloadDocument]. - - Attributes: - name: - Required. The name of the document to reload. Format: - ``projects//knowledgeBases//documents/`` - source: - The source for document reloading. Optional. If provided, the - service will load the contents from the source and update - document in the knowledge base. - gcs_source: - The path for a Cloud Storage source file for reloading - document content. If not provided, the Document’s existing - source will be reloaded. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ReloadDocumentRequest) - }, -) -_sym_db.RegisterMessage(ReloadDocumentRequest) - -AutoApproveSmartMessagingEntriesResponse = _reflection.GeneratedProtocolMessageType( - "AutoApproveSmartMessagingEntriesResponse", - (_message.Message,), - { - "DESCRIPTOR": _AUTOAPPROVESMARTMESSAGINGENTRIESRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.document_pb2", - "__doc__": """Response message for [Documents.AutoApproveSmartMessagingEntries]. - - Attributes: - enabled_count: - Number of smart messaging entries enabled. - disabled_count: - Number of smart messaging entries disabled. - unreviewed_count: - Number of smart messaging entries unreviewed. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.AutoApproveSmartMessagingEntriesResponse) - }, -) -_sym_db.RegisterMessage(AutoApproveSmartMessagingEntriesResponse) - - -DESCRIPTOR._options = None -_DOCUMENT.fields_by_name["name"]._options = None -_DOCUMENT.fields_by_name["display_name"]._options = None -_DOCUMENT.fields_by_name["mime_type"]._options = None -_DOCUMENT.fields_by_name["knowledge_types"]._options = None -_DOCUMENT.fields_by_name["content"]._options = None -_DOCUMENT.fields_by_name["enable_auto_reload"]._options = None -_DOCUMENT.fields_by_name["latest_reload_status"]._options = None -_DOCUMENT._options = None -_GETDOCUMENTREQUEST.fields_by_name["name"]._options = None -_LISTDOCUMENTSREQUEST.fields_by_name["parent"]._options = None -_CREATEDOCUMENTREQUEST.fields_by_name["parent"]._options = None -_CREATEDOCUMENTREQUEST.fields_by_name["document"]._options = None -_DELETEDOCUMENTREQUEST.fields_by_name["name"]._options = None -_UPDATEDOCUMENTREQUEST.fields_by_name["document"]._options = None -_UPDATEDOCUMENTREQUEST.fields_by_name["update_mask"]._options = None -_KNOWLEDGEOPERATIONMETADATA.fields_by_name["state"]._options = None -_RELOADDOCUMENTREQUEST.fields_by_name["name"]._options = None - -_DOCUMENTS = _descriptor.ServiceDescriptor( - name="Documents", - full_name="google.cloud.dialogflow.v2beta1.Documents", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=2229, - serialized_end=4146, - methods=[ - _descriptor.MethodDescriptor( - name="ListDocuments", - full_name="google.cloud.dialogflow.v2beta1.Documents.ListDocuments", - index=0, - containing_service=None, - input_type=_LISTDOCUMENTSREQUEST, - output_type=_LISTDOCUMENTSRESPONSE, - serialized_options=b"\202\323\344\223\002z\0227/v2beta1/{parent=projects/*/knowledgeBases/*}/documentsZ?\022=/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetDocument", - full_name="google.cloud.dialogflow.v2beta1.Documents.GetDocument", - index=1, - containing_service=None, - input_type=_GETDOCUMENTREQUEST, - output_type=_DOCUMENT, - serialized_options=b"\202\323\344\223\002z\0227/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}Z?\022=/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateDocument", - full_name="google.cloud.dialogflow.v2beta1.Documents.CreateDocument", - index=2, - containing_service=None, - input_type=_CREATEDOCUMENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002\216\001"7/v2beta1/{parent=projects/*/knowledgeBases/*}/documents:\010documentZI"=/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents:\010document\332A\017parent,document\312A&\n\010Document\022\032KnowledgeOperationMetadata', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteDocument", - full_name="google.cloud.dialogflow.v2beta1.Documents.DeleteDocument", - index=3, - containing_service=None, - input_type=_DELETEDOCUMENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b"\202\323\344\223\002z*7/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}Z?*=/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}\332A\004name\312A3\n\025google.protobuf.Empty\022\032KnowledgeOperationMetadata", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateDocument", - full_name="google.cloud.dialogflow.v2beta1.Documents.UpdateDocument", - index=4, - containing_service=None, - input_type=_UPDATEDOCUMENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b"\202\323\344\223\002\240\0012@/v2beta1/{document.name=projects/*/knowledgeBases/*/documents/*}:\010documentZR2F/v2beta1/{document.name=projects/*/agent/knowledgeBases/*/documents/*}:\010document\332A\024document,update_mask\332A\010document\312A&\n\010Document\022\032KnowledgeOperationMetadata", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ReloadDocument", - full_name="google.cloud.dialogflow.v2beta1.Documents.ReloadDocument", - index=5, - containing_service=None, - input_type=_RELOADDOCUMENTREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002\216\001">/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}:reload:\001*ZI"D/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload:\001*\312A&\n\010Document\022\032KnowledgeOperationMetadata', - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_DOCUMENTS) - -DESCRIPTOR.services_by_name["Documents"] = _DOCUMENTS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/document_pb2_grpc.py b/dialogflow_v2beta1/proto/document_pb2_grpc.py deleted file mode 100644 index 78f166583..000000000 --- a/dialogflow_v2beta1/proto/document_pb2_grpc.py +++ /dev/null @@ -1,327 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2beta1.proto import ( - document_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) - - -class DocumentsStub(object): - """Service for managing knowledge [Documents][google.cloud.dialogflow.v2beta1.Document]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListDocuments = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Documents/ListDocuments", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.ListDocumentsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.ListDocumentsResponse.FromString, - ) - self.GetDocument = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Documents/GetDocument", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.GetDocumentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.Document.FromString, - ) - self.CreateDocument = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Documents/CreateDocument", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.CreateDocumentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.DeleteDocument = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Documents/DeleteDocument", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.DeleteDocumentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.UpdateDocument = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Documents/UpdateDocument", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.UpdateDocumentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.ReloadDocument = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Documents/ReloadDocument", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.ReloadDocumentRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - - -class DocumentsServicer(object): - """Service for managing knowledge [Documents][google.cloud.dialogflow.v2beta1.Document]. - """ - - def ListDocuments(self, request, context): - """Returns the list of all documents of the knowledge base. - - Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - only use `projects.knowledgeBases.documents`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetDocument(self, request, context): - """Retrieves the specified document. - - Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - only use `projects.knowledgeBases.documents`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateDocument(self, request, context): - """Creates a new document. - - Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - only use `projects.knowledgeBases.documents`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteDocument(self, request, context): - """Deletes the specified document. - - Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - only use `projects.knowledgeBases.documents`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateDocument(self, request, context): - """Updates the specified document. - - Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - only use `projects.knowledgeBases.documents`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ReloadDocument(self, request, context): - """Reloads the specified document from its specified source, content_uri or - content. The previously loaded content of the document will be deleted. - Note: Even when the content of the document has not changed, there still - may be side effects because of internal implementation changes. - - Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; - only use `projects.knowledgeBases.documents`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_DocumentsServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListDocuments": grpc.unary_unary_rpc_method_handler( - servicer.ListDocuments, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.ListDocumentsRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.ListDocumentsResponse.SerializeToString, - ), - "GetDocument": grpc.unary_unary_rpc_method_handler( - servicer.GetDocument, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.GetDocumentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.Document.SerializeToString, - ), - "CreateDocument": grpc.unary_unary_rpc_method_handler( - servicer.CreateDocument, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.CreateDocumentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "DeleteDocument": grpc.unary_unary_rpc_method_handler( - servicer.DeleteDocument, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.DeleteDocumentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "UpdateDocument": grpc.unary_unary_rpc_method_handler( - servicer.UpdateDocument, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.UpdateDocumentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "ReloadDocument": grpc.unary_unary_rpc_method_handler( - servicer.ReloadDocument, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.ReloadDocumentRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2beta1.Documents", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Documents(object): - """Service for managing knowledge [Documents][google.cloud.dialogflow.v2beta1.Document]. - """ - - @staticmethod - def ListDocuments( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Documents/ListDocuments", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.ListDocumentsRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.ListDocumentsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetDocument( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Documents/GetDocument", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.GetDocumentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.Document.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateDocument( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Documents/CreateDocument", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.CreateDocumentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteDocument( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Documents/DeleteDocument", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.DeleteDocumentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateDocument( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Documents/UpdateDocument", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.UpdateDocumentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def ReloadDocument( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Documents/ReloadDocument", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_document__pb2.ReloadDocumentRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2beta1/proto/entity_type_pb2.py b/dialogflow_v2beta1/proto/entity_type_pb2.py deleted file mode 100644 index 3037fecec..000000000 --- a/dialogflow_v2beta1/proto/entity_type_pb2.py +++ /dev/null @@ -1,1885 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/entity_type.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/entity_type.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\017EntityTypeProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n7google/cloud/dialogflow_v2beta1/proto/entity_type.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\xc8\x05\n\nEntityType\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x43\n\x04kind\x18\x03 \x01(\x0e\x32\x30.google.cloud.dialogflow.v2beta1.EntityType.KindB\x03\xe0\x41\x02\x12_\n\x13\x61uto_expansion_mode\x18\x04 \x01(\x0e\x32=.google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionModeB\x03\xe0\x41\x01\x12I\n\x08\x65ntities\x18\x06 \x03(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.EntityType.EntityB\x03\xe0\x41\x01\x12$\n\x17\x65nable_fuzzy_extraction\x18\x07 \x01(\x08\x42\x03\xe0\x41\x01\x1a)\n\x06\x45ntity\x12\r\n\x05value\x18\x01 \x01(\t\x12\x10\n\x08synonyms\x18\x02 \x03(\t"J\n\x04Kind\x12\x14\n\x10KIND_UNSPECIFIED\x10\x00\x12\x0c\n\x08KIND_MAP\x10\x01\x12\r\n\tKIND_LIST\x10\x02\x12\x0f\n\x0bKIND_REGEXP\x10\x03"Y\n\x11\x41utoExpansionMode\x12#\n\x1f\x41UTO_EXPANSION_MODE_UNSPECIFIED\x10\x00\x12\x1f\n\x1b\x41UTO_EXPANSION_MODE_DEFAULT\x10\x01:\xa7\x01\xea\x41\xa3\x01\n$dialogflow.googleapis.com/EntityType\x12\x32projects/{project}/agent/entityTypes/{entity_type}\x12Gprojects/{project}/locations/{location}/agent/entityTypes/{entity_type}"\xa3\x01\n\x16ListEntityTypesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\x12$dialogflow.googleapis.com/EntityType\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x04 \x01(\tB\x03\xe0\x41\x01"u\n\x17ListEntityTypesResponse\x12\x41\n\x0c\x65ntity_types\x18\x01 \x03(\x0b\x32+.google.cloud.dialogflow.v2beta1.EntityType\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"n\n\x14GetEntityTypeRequest\x12:\n\x04name\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$dialogflow.googleapis.com/EntityType\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01"\xba\x01\n\x17\x43reateEntityTypeRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\x12$dialogflow.googleapis.com/EntityType\x12\x45\n\x0b\x65ntity_type\x18\x02 \x01(\x0b\x32+.google.cloud.dialogflow.v2beta1.EntityTypeB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01"\xb2\x01\n\x17UpdateEntityTypeRequest\x12\x45\n\x0b\x65ntity_type\x18\x01 \x01(\x0b\x32+.google.cloud.dialogflow.v2beta1.EntityTypeB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x34\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01"U\n\x17\x44\x65leteEntityTypeRequest\x12:\n\x04name\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$dialogflow.googleapis.com/EntityType"\xbb\x02\n\x1d\x42\x61tchUpdateEntityTypesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\x12$dialogflow.googleapis.com/EntityType\x12\x1f\n\x15\x65ntity_type_batch_uri\x18\x02 \x01(\tH\x00\x12T\n\x18\x65ntity_type_batch_inline\x18\x03 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2beta1.EntityTypeBatchH\x00\x12\x1a\n\rlanguage_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x34\n\x0bupdate_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\x42\x13\n\x11\x65ntity_type_batch"c\n\x1e\x42\x61tchUpdateEntityTypesResponse\x12\x41\n\x0c\x65ntity_types\x18\x01 \x03(\x0b\x32+.google.cloud.dialogflow.v2beta1.EntityType"}\n\x1d\x42\x61tchDeleteEntityTypesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\x12$dialogflow.googleapis.com/EntityType\x12\x1e\n\x11\x65ntity_type_names\x18\x02 \x03(\tB\x03\xe0\x41\x02"\xc1\x01\n\x1a\x42\x61tchCreateEntitiesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$dialogflow.googleapis.com/EntityType\x12I\n\x08\x65ntities\x18\x02 \x03(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.EntityType.EntityB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01"\xf2\x01\n\x1a\x42\x61tchUpdateEntitiesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$dialogflow.googleapis.com/EntityType\x12I\n\x08\x65ntities\x18\x02 \x03(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.EntityType.EntityB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12/\n\x0bupdate_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"\x92\x01\n\x1a\x42\x61tchDeleteEntitiesRequest\x12<\n\x06parent\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$dialogflow.googleapis.com/EntityType\x12\x1a\n\rentity_values\x18\x02 \x03(\tB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01"T\n\x0f\x45ntityTypeBatch\x12\x41\n\x0c\x65ntity_types\x18\x01 \x03(\x0b\x32+.google.cloud.dialogflow.v2beta1.EntityType2\xae\x1b\n\x0b\x45ntityTypes\x12\x9b\x02\n\x0fListEntityTypes\x12\x37.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest\x1a\x38.google.cloud.dialogflow.v2beta1.ListEntityTypesResponse"\x94\x01\x82\xd3\xe4\x93\x02n\x12./v2beta1/{parent=projects/*/agent}/entityTypesZ<\x12:/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes\xda\x41\x06parent\xda\x41\x14parent,language_code\x12\x86\x02\n\rGetEntityType\x12\x35.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest\x1a+.google.cloud.dialogflow.v2beta1.EntityType"\x90\x01\x82\xd3\xe4\x93\x02n\x12./v2beta1/{name=projects/*/agent/entityTypes/*}Z<\x12:/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}\xda\x41\x04name\xda\x41\x12name,language_code\x12\xc3\x02\n\x10\x43reateEntityType\x12\x38.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest\x1a+.google.cloud.dialogflow.v2beta1.EntityType"\xc7\x01\x82\xd3\xe4\x93\x02\x88\x01"./v2beta1/{parent=projects/*/agent}/entityTypes:\x0b\x65ntity_typeZI":/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:\x0b\x65ntity_type\xda\x41\x12parent,entity_type\xda\x41 parent,entity_type,language_code\x12\xf5\x02\n\x10UpdateEntityType\x12\x38.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest\x1a+.google.cloud.dialogflow.v2beta1.EntityType"\xf9\x01\x82\xd3\xe4\x93\x02\xa0\x01\x32:/v2beta1/{entity_type.name=projects/*/agent/entityTypes/*}:\x0b\x65ntity_typeZU2F/v2beta1/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}:\x0b\x65ntity_type\xda\x41\x0b\x65ntity_type\xda\x41\x19\x65ntity_type,language_code\xda\x41%entity_type,language_code,update_mask\x12\xe1\x01\n\x10\x44\x65leteEntityType\x12\x38.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest\x1a\x16.google.protobuf.Empty"{\x82\xd3\xe4\x93\x02n*./v2beta1/{name=projects/*/agent/entityTypes/*}Z<*:/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}\xda\x41\x04name\x12\xe8\x02\n\x16\x42\x61tchUpdateEntityTypes\x12>.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest\x1a\x1d.google.longrunning.Operation"\xee\x01\x82\xd3\xe4\x93\x02\x8c\x01":/v2beta1/{parent=projects/*/agent}/entityTypes:batchUpdate:\x01*ZK"F/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate:\x01*\xca\x41X\n>google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse\x12\x16google.protobuf.Struct\x12\xda\x02\n\x16\x42\x61tchDeleteEntityTypes\x12>.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest\x1a\x1d.google.longrunning.Operation"\xe0\x01\x82\xd3\xe4\x93\x02\x8c\x01":/v2beta1/{parent=projects/*/agent}/entityTypes:batchDelete:\x01*ZK"F/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete:\x01*\xda\x41\x18parent,entity_type_names\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\x81\x03\n\x13\x42\x61tchCreateEntities\x12;.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest\x1a\x1d.google.longrunning.Operation"\x8d\x02\x82\xd3\xe4\x93\x02\xa2\x01"E/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate:\x01*ZV"Q/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate:\x01*\xda\x41\x0fparent,entities\xda\x41\x1dparent,entities,language_code\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\x81\x03\n\x13\x42\x61tchUpdateEntities\x12;.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest\x1a\x1d.google.longrunning.Operation"\x8d\x02\x82\xd3\xe4\x93\x02\xa2\x01"E/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate:\x01*ZV"Q/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate:\x01*\xda\x41\x0fparent,entities\xda\x41\x1dparent,entities,language_code\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x12\x8b\x03\n\x13\x42\x61tchDeleteEntities\x12;.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest\x1a\x1d.google.longrunning.Operation"\x97\x02\x82\xd3\xe4\x93\x02\xa2\x01"E/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete:\x01*ZV"Q/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete:\x01*\xda\x41\x14parent,entity_values\xda\x41"parent,entity_values,language_code\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\xad\x01\n#com.google.cloud.dialogflow.v2beta1B\x0f\x45ntityTypeProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - ], -) - - -_ENTITYTYPE_KIND = _descriptor.EnumDescriptor( - name="Kind", - full_name="google.cloud.dialogflow.v2beta1.EntityType.Kind", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="KIND_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="KIND_MAP", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="KIND_LIST", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="KIND_REGEXP", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=685, - serialized_end=759, -) -_sym_db.RegisterEnumDescriptor(_ENTITYTYPE_KIND) - -_ENTITYTYPE_AUTOEXPANSIONMODE = _descriptor.EnumDescriptor( - name="AutoExpansionMode", - full_name="google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionMode", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="AUTO_EXPANSION_MODE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUTO_EXPANSION_MODE_DEFAULT", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=761, - serialized_end=850, -) -_sym_db.RegisterEnumDescriptor(_ENTITYTYPE_AUTOEXPANSIONMODE) - - -_ENTITYTYPE_ENTITY = _descriptor.Descriptor( - name="Entity", - full_name="google.cloud.dialogflow.v2beta1.EntityType.Entity", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="value", - full_name="google.cloud.dialogflow.v2beta1.EntityType.Entity.value", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="synonyms", - full_name="google.cloud.dialogflow.v2beta1.EntityType.Entity.synonyms", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=642, - serialized_end=683, -) - -_ENTITYTYPE = _descriptor.Descriptor( - name="EntityType", - full_name="google.cloud.dialogflow.v2beta1.EntityType", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.EntityType.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.dialogflow.v2beta1.EntityType.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="kind", - full_name="google.cloud.dialogflow.v2beta1.EntityType.kind", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="auto_expansion_mode", - full_name="google.cloud.dialogflow.v2beta1.EntityType.auto_expansion_mode", - index=3, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entities", - full_name="google.cloud.dialogflow.v2beta1.EntityType.entities", - index=4, - number=6, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="enable_fuzzy_extraction", - full_name="google.cloud.dialogflow.v2beta1.EntityType.enable_fuzzy_extraction", - index=5, - number=7, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_ENTITYTYPE_ENTITY], - enum_types=[_ENTITYTYPE_KIND, _ENTITYTYPE_AUTOEXPANSIONMODE], - serialized_options=b"\352A\243\001\n$dialogflow.googleapis.com/EntityType\0222projects/{project}/agent/entityTypes/{entity_type}\022Gprojects/{project}/locations/{location}/agent/entityTypes/{entity_type}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=308, - serialized_end=1020, -) - - -_LISTENTITYTYPESREQUEST = _descriptor.Descriptor( - name="ListEntityTypesRequest", - full_name="google.cloud.dialogflow.v2beta1.ListEntityTypesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.ListEntityTypesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\022$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.ListEntityTypesRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2beta1.ListEntityTypesRequest.page_size", - index=2, - number=3, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2beta1.ListEntityTypesRequest.page_token", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1023, - serialized_end=1186, -) - - -_LISTENTITYTYPESRESPONSE = _descriptor.Descriptor( - name="ListEntityTypesResponse", - full_name="google.cloud.dialogflow.v2beta1.ListEntityTypesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="entity_types", - full_name="google.cloud.dialogflow.v2beta1.ListEntityTypesResponse.entity_types", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2beta1.ListEntityTypesResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1188, - serialized_end=1305, -) - - -_GETENTITYTYPEREQUEST = _descriptor.Descriptor( - name="GetEntityTypeRequest", - full_name="google.cloud.dialogflow.v2beta1.GetEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.GetEntityTypeRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\n$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.GetEntityTypeRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1307, - serialized_end=1417, -) - - -_CREATEENTITYTYPEREQUEST = _descriptor.Descriptor( - name="CreateEntityTypeRequest", - full_name="google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\022$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type", - full_name="google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest.entity_type", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1420, - serialized_end=1606, -) - - -_UPDATEENTITYTYPEREQUEST = _descriptor.Descriptor( - name="UpdateEntityTypeRequest", - full_name="google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="entity_type", - full_name="google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest.entity_type", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest.update_mask", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1609, - serialized_end=1787, -) - - -_DELETEENTITYTYPEREQUEST = _descriptor.Descriptor( - name="DeleteEntityTypeRequest", - full_name="google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\n$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1789, - serialized_end=1874, -) - - -_BATCHUPDATEENTITYTYPESREQUEST = _descriptor.Descriptor( - name="BatchUpdateEntityTypesRequest", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\022$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type_batch_uri", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.entity_type_batch_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type_batch_inline", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.entity_type_batch_inline", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.language_code", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.update_mask", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="entity_type_batch", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.entity_type_batch", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=1877, - serialized_end=2192, -) - - -_BATCHUPDATEENTITYTYPESRESPONSE = _descriptor.Descriptor( - name="BatchUpdateEntityTypesResponse", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="entity_types", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse.entity_types", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2194, - serialized_end=2293, -) - - -_BATCHDELETEENTITYTYPESREQUEST = _descriptor.Descriptor( - name="BatchDeleteEntityTypesRequest", - full_name="google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\022$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type_names", - full_name="google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest.entity_type_names", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2295, - serialized_end=2420, -) - - -_BATCHCREATEENTITIESREQUEST = _descriptor.Descriptor( - name="BatchCreateEntitiesRequest", - full_name="google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\n$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entities", - full_name="google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest.entities", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2423, - serialized_end=2616, -) - - -_BATCHUPDATEENTITIESREQUEST = _descriptor.Descriptor( - name="BatchUpdateEntitiesRequest", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\n$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entities", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.entities", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.update_mask", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2619, - serialized_end=2861, -) - - -_BATCHDELETEENTITIESREQUEST = _descriptor.Descriptor( - name="BatchDeleteEntitiesRequest", - full_name="google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A&\n$dialogflow.googleapis.com/EntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_values", - full_name="google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest.entity_values", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2864, - serialized_end=3010, -) - - -_ENTITYTYPEBATCH = _descriptor.Descriptor( - name="EntityTypeBatch", - full_name="google.cloud.dialogflow.v2beta1.EntityTypeBatch", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="entity_types", - full_name="google.cloud.dialogflow.v2beta1.EntityTypeBatch.entity_types", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3012, - serialized_end=3096, -) - -_ENTITYTYPE_ENTITY.containing_type = _ENTITYTYPE -_ENTITYTYPE.fields_by_name["kind"].enum_type = _ENTITYTYPE_KIND -_ENTITYTYPE.fields_by_name[ - "auto_expansion_mode" -].enum_type = _ENTITYTYPE_AUTOEXPANSIONMODE -_ENTITYTYPE.fields_by_name["entities"].message_type = _ENTITYTYPE_ENTITY -_ENTITYTYPE_KIND.containing_type = _ENTITYTYPE -_ENTITYTYPE_AUTOEXPANSIONMODE.containing_type = _ENTITYTYPE -_LISTENTITYTYPESRESPONSE.fields_by_name["entity_types"].message_type = _ENTITYTYPE -_CREATEENTITYTYPEREQUEST.fields_by_name["entity_type"].message_type = _ENTITYTYPE -_UPDATEENTITYTYPEREQUEST.fields_by_name["entity_type"].message_type = _ENTITYTYPE -_UPDATEENTITYTYPEREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name[ - "entity_type_batch_inline" -].message_type = _ENTITYTYPEBATCH -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_BATCHUPDATEENTITYTYPESREQUEST.oneofs_by_name["entity_type_batch"].fields.append( - _BATCHUPDATEENTITYTYPESREQUEST.fields_by_name["entity_type_batch_uri"] -) -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name[ - "entity_type_batch_uri" -].containing_oneof = _BATCHUPDATEENTITYTYPESREQUEST.oneofs_by_name["entity_type_batch"] -_BATCHUPDATEENTITYTYPESREQUEST.oneofs_by_name["entity_type_batch"].fields.append( - _BATCHUPDATEENTITYTYPESREQUEST.fields_by_name["entity_type_batch_inline"] -) -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name[ - "entity_type_batch_inline" -].containing_oneof = _BATCHUPDATEENTITYTYPESREQUEST.oneofs_by_name["entity_type_batch"] -_BATCHUPDATEENTITYTYPESRESPONSE.fields_by_name[ - "entity_types" -].message_type = _ENTITYTYPE -_BATCHCREATEENTITIESREQUEST.fields_by_name["entities"].message_type = _ENTITYTYPE_ENTITY -_BATCHUPDATEENTITIESREQUEST.fields_by_name["entities"].message_type = _ENTITYTYPE_ENTITY -_BATCHUPDATEENTITIESREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_ENTITYTYPEBATCH.fields_by_name["entity_types"].message_type = _ENTITYTYPE -DESCRIPTOR.message_types_by_name["EntityType"] = _ENTITYTYPE -DESCRIPTOR.message_types_by_name["ListEntityTypesRequest"] = _LISTENTITYTYPESREQUEST -DESCRIPTOR.message_types_by_name["ListEntityTypesResponse"] = _LISTENTITYTYPESRESPONSE -DESCRIPTOR.message_types_by_name["GetEntityTypeRequest"] = _GETENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name["CreateEntityTypeRequest"] = _CREATEENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name["UpdateEntityTypeRequest"] = _UPDATEENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name["DeleteEntityTypeRequest"] = _DELETEENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchUpdateEntityTypesRequest" -] = _BATCHUPDATEENTITYTYPESREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchUpdateEntityTypesResponse" -] = _BATCHUPDATEENTITYTYPESRESPONSE -DESCRIPTOR.message_types_by_name[ - "BatchDeleteEntityTypesRequest" -] = _BATCHDELETEENTITYTYPESREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchCreateEntitiesRequest" -] = _BATCHCREATEENTITIESREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchUpdateEntitiesRequest" -] = _BATCHUPDATEENTITIESREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchDeleteEntitiesRequest" -] = _BATCHDELETEENTITIESREQUEST -DESCRIPTOR.message_types_by_name["EntityTypeBatch"] = _ENTITYTYPEBATCH -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -EntityType = _reflection.GeneratedProtocolMessageType( - "EntityType", - (_message.Message,), - { - "Entity": _reflection.GeneratedProtocolMessageType( - "Entity", - (_message.Message,), - { - "DESCRIPTOR": _ENTITYTYPE_ENTITY, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """An **entity entry** for an associated entity type. - - Attributes: - value: - Required. The primary value associated with this entity entry. - For example, if the entity type is *vegetable*, the value - could be *scallions*. For ``KIND_MAP`` entity types: - A - reference value to be used in place of synonyms. For - ``KIND_LIST`` entity types: - A string that can contain - references to other entity types (with or without aliases). - synonyms: - Required. A collection of value synonyms. For example, if the - entity type is *vegetable*, and ``value`` is *scallions*, a - synonym could be *green onions*. For ``KIND_LIST`` entity - types: - This collection must contain exactly one synonym - equal to ``value``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.EntityType.Entity) - }, - ), - "DESCRIPTOR": _ENTITYTYPE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """Each intent parameter has a type, called the entity type, which - dictates exactly how data from an end-user expression is extracted. - Dialogflow provides predefined system entities that can match many - common types of data. For example, there are system entities for - matching dates, times, colors, email addresses, and so on. You can - also create your own custom entities for matching custom data. For - example, you could define a vegetable entity that can match the types - of vegetables available for purchase with a grocery store agent. For - more information, see the `Entity guide - `__. - - Attributes: - name: - The unique identifier of the entity type. Required for [Entity - Types.UpdateEntityType][google.cloud.dialogflow.v2beta1.Entity - Types.UpdateEntityType] and [EntityTypes.BatchUpdateEntityType - s][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEnti - tyTypes] methods. Format: ``projects//agent/entityTypes/``. - display_name: - Required. The name of the entity type. - kind: - Required. Indicates the kind of entity type. - auto_expansion_mode: - Optional. Indicates whether the entity type can be - automatically expanded. - entities: - Optional. The collection of entity entries associated with the - entity type. - enable_fuzzy_extraction: - Optional. Enables fuzzy entity extraction during - classification. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.EntityType) - }, -) -_sym_db.RegisterMessage(EntityType) -_sym_db.RegisterMessage(EntityType.Entity) - -ListEntityTypesRequest = _reflection.GeneratedProtocolMessageType( - "ListEntityTypesRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTENTITYTYPESREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.ListEntityTypes][google.cloud.dia - logflow.v2beta1.EntityTypes.ListEntityTypes]. - - Attributes: - parent: - Required. The agent to list all entity types from. Format: - ``projects//agent``. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListEntityTypesRequest) - }, -) -_sym_db.RegisterMessage(ListEntityTypesRequest) - -ListEntityTypesResponse = _reflection.GeneratedProtocolMessageType( - "ListEntityTypesResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTENTITYTYPESRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The response message for [EntityTypes.ListEntityTypes][google.cloud.di - alogflow.v2beta1.EntityTypes.ListEntityTypes]. - - Attributes: - entity_types: - The list of agent entity types. There will be a maximum number - of items returned based on the page_size field in the request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListEntityTypesResponse) - }, -) -_sym_db.RegisterMessage(ListEntityTypesResponse) - -GetEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "GetEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.GetEntityType][google.cloud.dialo - gflow.v2beta1.EntityTypes.GetEntityType]. - - Attributes: - name: - Required. The name of the entity type. Format: - ``projects//agent/entityTypes/``. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.GetEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(GetEntityTypeRequest) - -CreateEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "CreateEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.CreateEntityType][google.cloud.di - alogflow.v2beta1.EntityTypes.CreateEntityType]. - - Attributes: - parent: - Required. The agent to create a entity type for. Format: - ``projects//agent``. - entity_type: - Required. The entity type to create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(CreateEntityTypeRequest) - -UpdateEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "UpdateEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.UpdateEntityType][google.cloud.di - alogflow.v2beta1.EntityTypes.UpdateEntityType]. - - Attributes: - entity_type: - Required. The entity type to update. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(UpdateEntityTypeRequest) - -DeleteEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "DeleteEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.DeleteEntityType][google.cloud.di - alogflow.v2beta1.EntityTypes.DeleteEntityType]. - - Attributes: - name: - Required. The name of the entity type to delete. Format: - ``projects//agent/entityTypes/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(DeleteEntityTypeRequest) - -BatchUpdateEntityTypesRequest = _reflection.GeneratedProtocolMessageType( - "BatchUpdateEntityTypesRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEENTITYTYPESREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.BatchUpdateEntityTypes][google.cl - oud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. - - Attributes: - parent: - Required. The name of the agent to update or create entity - types in. Format: ``projects//agent``. - entity_type_batch: - The source of the entity type batch. For each entity type in - the batch: - If ``name`` is specified, we update an existing - entity type. - If ``name`` is not specified, we create a new - entity type. - entity_type_batch_uri: - The URI to a Google Cloud Storage file containing entity types - to update or create. The file format can either be a - serialized proto (of EntityBatch type) or a JSON object. Note: - The URI must start with “gs://”. - entity_type_batch_inline: - The collection of entity types to update or create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest) - }, -) -_sym_db.RegisterMessage(BatchUpdateEntityTypesRequest) - -BatchUpdateEntityTypesResponse = _reflection.GeneratedProtocolMessageType( - "BatchUpdateEntityTypesResponse", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEENTITYTYPESRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The response message for [EntityTypes.BatchUpdateEntityTypes][google.c - loud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. - - Attributes: - entity_types: - The collection of updated or created entity types. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse) - }, -) -_sym_db.RegisterMessage(BatchUpdateEntityTypesResponse) - -BatchDeleteEntityTypesRequest = _reflection.GeneratedProtocolMessageType( - "BatchDeleteEntityTypesRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHDELETEENTITYTYPESREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.BatchDeleteEntityTypes][google.cl - oud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes]. - - Attributes: - parent: - Required. The name of the agent to delete all entities types - for. Format: ``projects//agent``. - entity_type_names: - Required. The names entity types to delete. All names must - point to the same agent as ``parent``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest) - }, -) -_sym_db.RegisterMessage(BatchDeleteEntityTypesRequest) - -BatchCreateEntitiesRequest = _reflection.GeneratedProtocolMessageType( - "BatchCreateEntitiesRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHCREATEENTITIESREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.BatchCreateEntities][google.cloud - .dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. - - Attributes: - parent: - Required. The name of the entity type to create entities in. - Format: ``projects//agent/entityTypes/``. - entities: - Required. The entities to create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest) - }, -) -_sym_db.RegisterMessage(BatchCreateEntitiesRequest) - -BatchUpdateEntitiesRequest = _reflection.GeneratedProtocolMessageType( - "BatchUpdateEntitiesRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEENTITIESREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.BatchUpdateEntities][google.cloud - .dialogflow.v2beta1.EntityTypes.BatchUpdateEntities]. - - Attributes: - parent: - Required. The name of the entity type to update or create - entities in. Format: ``projects//agent/entityTypes/``. - entities: - Required. The entities to update or create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest) - }, -) -_sym_db.RegisterMessage(BatchUpdateEntitiesRequest) - -BatchDeleteEntitiesRequest = _reflection.GeneratedProtocolMessageType( - "BatchDeleteEntitiesRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHDELETEENTITIESREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """The request message for [EntityTypes.BatchDeleteEntities][google.cloud - .dialogflow.v2beta1.EntityTypes.BatchDeleteEntities]. - - Attributes: - parent: - Required. The name of the entity type to delete entries for. - Format: ``projects//agent/entityTypes/``. - entity_values: - Required. The reference ``values`` of the entities to delete. - Note that these are not fully-qualified names, i.e. they don’t - start with ``projects/``. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest) - }, -) -_sym_db.RegisterMessage(BatchDeleteEntitiesRequest) - -EntityTypeBatch = _reflection.GeneratedProtocolMessageType( - "EntityTypeBatch", - (_message.Message,), - { - "DESCRIPTOR": _ENTITYTYPEBATCH, - "__module__": "google.cloud.dialogflow_v2beta1.proto.entity_type_pb2", - "__doc__": """This message is a wrapper around a collection of entity types. - - Attributes: - entity_types: - A collection of entity types. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.EntityTypeBatch) - }, -) -_sym_db.RegisterMessage(EntityTypeBatch) - - -DESCRIPTOR._options = None -_ENTITYTYPE.fields_by_name["display_name"]._options = None -_ENTITYTYPE.fields_by_name["kind"]._options = None -_ENTITYTYPE.fields_by_name["auto_expansion_mode"]._options = None -_ENTITYTYPE.fields_by_name["entities"]._options = None -_ENTITYTYPE.fields_by_name["enable_fuzzy_extraction"]._options = None -_ENTITYTYPE._options = None -_LISTENTITYTYPESREQUEST.fields_by_name["parent"]._options = None -_LISTENTITYTYPESREQUEST.fields_by_name["language_code"]._options = None -_LISTENTITYTYPESREQUEST.fields_by_name["page_size"]._options = None -_LISTENTITYTYPESREQUEST.fields_by_name["page_token"]._options = None -_GETENTITYTYPEREQUEST.fields_by_name["name"]._options = None -_GETENTITYTYPEREQUEST.fields_by_name["language_code"]._options = None -_CREATEENTITYTYPEREQUEST.fields_by_name["parent"]._options = None -_CREATEENTITYTYPEREQUEST.fields_by_name["entity_type"]._options = None -_CREATEENTITYTYPEREQUEST.fields_by_name["language_code"]._options = None -_UPDATEENTITYTYPEREQUEST.fields_by_name["entity_type"]._options = None -_UPDATEENTITYTYPEREQUEST.fields_by_name["language_code"]._options = None -_UPDATEENTITYTYPEREQUEST.fields_by_name["update_mask"]._options = None -_DELETEENTITYTYPEREQUEST.fields_by_name["name"]._options = None -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name["parent"]._options = None -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name["language_code"]._options = None -_BATCHUPDATEENTITYTYPESREQUEST.fields_by_name["update_mask"]._options = None -_BATCHDELETEENTITYTYPESREQUEST.fields_by_name["parent"]._options = None -_BATCHDELETEENTITYTYPESREQUEST.fields_by_name["entity_type_names"]._options = None -_BATCHCREATEENTITIESREQUEST.fields_by_name["parent"]._options = None -_BATCHCREATEENTITIESREQUEST.fields_by_name["entities"]._options = None -_BATCHCREATEENTITIESREQUEST.fields_by_name["language_code"]._options = None -_BATCHUPDATEENTITIESREQUEST.fields_by_name["parent"]._options = None -_BATCHUPDATEENTITIESREQUEST.fields_by_name["entities"]._options = None -_BATCHUPDATEENTITIESREQUEST.fields_by_name["language_code"]._options = None -_BATCHDELETEENTITIESREQUEST.fields_by_name["parent"]._options = None -_BATCHDELETEENTITIESREQUEST.fields_by_name["entity_values"]._options = None -_BATCHDELETEENTITIESREQUEST.fields_by_name["language_code"]._options = None - -_ENTITYTYPES = _descriptor.ServiceDescriptor( - name="EntityTypes", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=3099, - serialized_end=6601, - methods=[ - _descriptor.MethodDescriptor( - name="ListEntityTypes", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes", - index=0, - containing_service=None, - input_type=_LISTENTITYTYPESREQUEST, - output_type=_LISTENTITYTYPESRESPONSE, - serialized_options=b"\202\323\344\223\002n\022./v2beta1/{parent=projects/*/agent}/entityTypesZ<\022:/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes\332A\006parent\332A\024parent,language_code", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetEntityType", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType", - index=1, - containing_service=None, - input_type=_GETENTITYTYPEREQUEST, - output_type=_ENTITYTYPE, - serialized_options=b"\202\323\344\223\002n\022./v2beta1/{name=projects/*/agent/entityTypes/*}Z<\022:/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}\332A\004name\332A\022name,language_code", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateEntityType", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType", - index=2, - containing_service=None, - input_type=_CREATEENTITYTYPEREQUEST, - output_type=_ENTITYTYPE, - serialized_options=b'\202\323\344\223\002\210\001"./v2beta1/{parent=projects/*/agent}/entityTypes:\013entity_typeZI":/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:\013entity_type\332A\022parent,entity_type\332A parent,entity_type,language_code', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateEntityType", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType", - index=3, - containing_service=None, - input_type=_UPDATEENTITYTYPEREQUEST, - output_type=_ENTITYTYPE, - serialized_options=b"\202\323\344\223\002\240\0012:/v2beta1/{entity_type.name=projects/*/agent/entityTypes/*}:\013entity_typeZU2F/v2beta1/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}:\013entity_type\332A\013entity_type\332A\031entity_type,language_code\332A%entity_type,language_code,update_mask", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteEntityType", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType", - index=4, - containing_service=None, - input_type=_DELETEENTITYTYPEREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002n*./v2beta1/{name=projects/*/agent/entityTypes/*}Z<*:/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchUpdateEntityTypes", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes", - index=5, - containing_service=None, - input_type=_BATCHUPDATEENTITYTYPESREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002\214\001":/v2beta1/{parent=projects/*/agent}/entityTypes:batchUpdate:\001*ZK"F/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate:\001*\312AX\n>google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchDeleteEntityTypes", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes", - index=6, - containing_service=None, - input_type=_BATCHDELETEENTITYTYPESREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002\214\001":/v2beta1/{parent=projects/*/agent}/entityTypes:batchDelete:\001*ZK"F/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete:\001*\332A\030parent,entity_type_names\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchCreateEntities", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities", - index=7, - containing_service=None, - input_type=_BATCHCREATEENTITIESREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002\242\001"E/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate:\001*ZV"Q/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate:\001*\332A\017parent,entities\332A\035parent,entities,language_code\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchUpdateEntities", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities", - index=8, - containing_service=None, - input_type=_BATCHUPDATEENTITIESREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002\242\001"E/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate:\001*ZV"Q/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate:\001*\332A\017parent,entities\332A\035parent,entities,language_code\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchDeleteEntities", - full_name="google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities", - index=9, - containing_service=None, - input_type=_BATCHDELETEENTITIESREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002\242\001"E/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete:\001*ZV"Q/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete:\001*\332A\024parent,entity_values\332A"parent,entity_values,language_code\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_ENTITYTYPES) - -DESCRIPTOR.services_by_name["EntityTypes"] = _ENTITYTYPES - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/entity_type_pb2_grpc.py b/dialogflow_v2beta1/proto/entity_type_pb2_grpc.py deleted file mode 100644 index eeb501526..000000000 --- a/dialogflow_v2beta1/proto/entity_type_pb2_grpc.py +++ /dev/null @@ -1,493 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2beta1.proto import ( - entity_type_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class EntityTypesStub(object): - """Service for managing [EntityTypes][google.cloud.dialogflow.v2beta1.EntityType]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListEntityTypes = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.EntityTypes/ListEntityTypes", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.ListEntityTypesRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.ListEntityTypesResponse.FromString, - ) - self.GetEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.EntityTypes/GetEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.GetEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.EntityType.FromString, - ) - self.CreateEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.EntityTypes/CreateEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.CreateEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.EntityType.FromString, - ) - self.UpdateEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.EntityTypes/UpdateEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.UpdateEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.EntityType.FromString, - ) - self.DeleteEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.EntityTypes/DeleteEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.DeleteEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.BatchUpdateEntityTypes = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchUpdateEntityTypes", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchUpdateEntityTypesRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.BatchDeleteEntityTypes = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchDeleteEntityTypes", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchDeleteEntityTypesRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.BatchCreateEntities = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchCreateEntities", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchCreateEntitiesRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.BatchUpdateEntities = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchUpdateEntities", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchUpdateEntitiesRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.BatchDeleteEntities = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchDeleteEntities", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchDeleteEntitiesRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - - -class EntityTypesServicer(object): - """Service for managing [EntityTypes][google.cloud.dialogflow.v2beta1.EntityType]. - """ - - def ListEntityTypes(self, request, context): - """Returns the list of all entity types in the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetEntityType(self, request, context): - """Retrieves the specified entity type. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateEntityType(self, request, context): - """Creates an entity type in the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateEntityType(self, request, context): - """Updates the specified entity type. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteEntityType(self, request, context): - """Deletes the specified entity type. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchUpdateEntityTypes(self, request, context): - """Updates/Creates multiple entity types in the specified agent. - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchDeleteEntityTypes(self, request, context): - """Deletes entity types in the specified agent. - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchCreateEntities(self, request, context): - """Creates multiple new entities in the specified entity type. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchUpdateEntities(self, request, context): - """Updates or creates multiple entities in the specified entity type. This - method does not affect entities in the entity type that aren't explicitly - specified in the request. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchDeleteEntities(self, request, context): - """Deletes entities in the specified entity type. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_EntityTypesServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListEntityTypes": grpc.unary_unary_rpc_method_handler( - servicer.ListEntityTypes, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.ListEntityTypesRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.ListEntityTypesResponse.SerializeToString, - ), - "GetEntityType": grpc.unary_unary_rpc_method_handler( - servicer.GetEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.GetEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.EntityType.SerializeToString, - ), - "CreateEntityType": grpc.unary_unary_rpc_method_handler( - servicer.CreateEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.CreateEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.EntityType.SerializeToString, - ), - "UpdateEntityType": grpc.unary_unary_rpc_method_handler( - servicer.UpdateEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.UpdateEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.EntityType.SerializeToString, - ), - "DeleteEntityType": grpc.unary_unary_rpc_method_handler( - servicer.DeleteEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.DeleteEntityTypeRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "BatchUpdateEntityTypes": grpc.unary_unary_rpc_method_handler( - servicer.BatchUpdateEntityTypes, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchUpdateEntityTypesRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "BatchDeleteEntityTypes": grpc.unary_unary_rpc_method_handler( - servicer.BatchDeleteEntityTypes, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchDeleteEntityTypesRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "BatchCreateEntities": grpc.unary_unary_rpc_method_handler( - servicer.BatchCreateEntities, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchCreateEntitiesRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "BatchUpdateEntities": grpc.unary_unary_rpc_method_handler( - servicer.BatchUpdateEntities, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchUpdateEntitiesRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "BatchDeleteEntities": grpc.unary_unary_rpc_method_handler( - servicer.BatchDeleteEntities, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchDeleteEntitiesRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2beta1.EntityTypes", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class EntityTypes(object): - """Service for managing [EntityTypes][google.cloud.dialogflow.v2beta1.EntityType]. - """ - - @staticmethod - def ListEntityTypes( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.EntityTypes/ListEntityTypes", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.ListEntityTypesRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.ListEntityTypesResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.EntityTypes/GetEntityType", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.GetEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.EntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.EntityTypes/CreateEntityType", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.CreateEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.EntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.EntityTypes/UpdateEntityType", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.UpdateEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.EntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.EntityTypes/DeleteEntityType", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.DeleteEntityTypeRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchUpdateEntityTypes( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchUpdateEntityTypes", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchUpdateEntityTypesRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchDeleteEntityTypes( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchDeleteEntityTypes", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchDeleteEntityTypesRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchCreateEntities( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchCreateEntities", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchCreateEntitiesRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchUpdateEntities( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchUpdateEntities", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchUpdateEntitiesRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchDeleteEntities( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchDeleteEntities", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.BatchDeleteEntitiesRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2beta1/proto/environment_pb2.py b/dialogflow_v2beta1/proto/environment_pb2.py deleted file mode 100644 index 9f8684a9b..000000000 --- a/dialogflow_v2beta1/proto/environment_pb2.py +++ /dev/null @@ -1,492 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/environment.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from dialogflow_v2beta1.proto import ( - audio_config_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/environment.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\020EnvironmentProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n7google/cloud/dialogflow_v2beta1/proto/environment.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x38google/cloud/dialogflow_v2beta1/proto/audio_config.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\xc8\x03\n\x0b\x45nvironment\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x18\n\x0b\x64\x65scription\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x1a\n\ragent_version\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x46\n\x05state\x18\x04 \x01(\x0e\x32\x32.google.cloud.dialogflow.v2beta1.Environment.StateB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03"E\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07STOPPED\x10\x01\x12\x0b\n\x07LOADING\x10\x02\x12\x0b\n\x07RUNNING\x10\x03:\xaa\x01\xea\x41\xa6\x01\n%dialogflow.googleapis.com/Environment\x12\x33projects/{project}/agent/environments/{environment}\x12Hprojects/{project}/locations/{location}/agent/environments/{environment}"\x89\x01\n\x17ListEnvironmentsRequest\x12=\n\x06parent\x18\x01 \x01(\tB-\xe0\x41\x02\xfa\x41\'\x12%dialogflow.googleapis.com/Environment\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01"w\n\x18ListEnvironmentsResponse\x12\x42\n\x0c\x65nvironments\x18\x01 \x03(\x0b\x32,.google.cloud.dialogflow.v2beta1.Environment\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t2\x93\x03\n\x0c\x45nvironments\x12\x88\x02\n\x10ListEnvironments\x12\x38.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest\x1a\x39.google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse"\x7f\x82\xd3\xe4\x93\x02p\x12//v2beta1/{parent=projects/*/agent}/environmentsZ=\x12;/v2beta1/{parent=projects/*/locations/*/agent}/environments\xda\x41\x06parent\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\xae\x01\n#com.google.cloud.dialogflow.v2beta1B\x10\x45nvironmentProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - ], -) - - -_ENVIRONMENT_STATE = _descriptor.EnumDescriptor( - name="State", - full_name="google.cloud.dialogflow.v2beta1.Environment.State", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="STATE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="STOPPED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LOADING", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="RUNNING", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=576, - serialized_end=645, -) -_sym_db.RegisterEnumDescriptor(_ENVIRONMENT_STATE) - - -_ENVIRONMENT = _descriptor.Descriptor( - name="Environment", - full_name="google.cloud.dialogflow.v2beta1.Environment", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.Environment.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2beta1.Environment.description", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="agent_version", - full_name="google.cloud.dialogflow.v2beta1.Environment.agent_version", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="state", - full_name="google.cloud.dialogflow.v2beta1.Environment.state", - index=3, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_time", - full_name="google.cloud.dialogflow.v2beta1.Environment.update_time", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_ENVIRONMENT_STATE], - serialized_options=b"\352A\246\001\n%dialogflow.googleapis.com/Environment\0223projects/{project}/agent/environments/{environment}\022Hprojects/{project}/locations/{location}/agent/environments/{environment}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=362, - serialized_end=818, -) - - -_LISTENVIRONMENTSREQUEST = _descriptor.Descriptor( - name="ListEnvironmentsRequest", - full_name="google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A'\022%dialogflow.googleapis.com/Environment", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=821, - serialized_end=958, -) - - -_LISTENVIRONMENTSRESPONSE = _descriptor.Descriptor( - name="ListEnvironmentsResponse", - full_name="google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="environments", - full_name="google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse.environments", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=960, - serialized_end=1079, -) - -_ENVIRONMENT.fields_by_name["state"].enum_type = _ENVIRONMENT_STATE -_ENVIRONMENT.fields_by_name[ - "update_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_ENVIRONMENT_STATE.containing_type = _ENVIRONMENT -_LISTENVIRONMENTSRESPONSE.fields_by_name["environments"].message_type = _ENVIRONMENT -DESCRIPTOR.message_types_by_name["Environment"] = _ENVIRONMENT -DESCRIPTOR.message_types_by_name["ListEnvironmentsRequest"] = _LISTENVIRONMENTSREQUEST -DESCRIPTOR.message_types_by_name["ListEnvironmentsResponse"] = _LISTENVIRONMENTSRESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Environment = _reflection.GeneratedProtocolMessageType( - "Environment", - (_message.Message,), - { - "DESCRIPTOR": _ENVIRONMENT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.environment_pb2", - "__doc__": """You can create multiple versions of your agent and publish them to - separate environments. When you edit an agent, you are editing the - draft agent. At any point, you can save the draft agent as an agent - version, which is an immutable snapshot of your agent. When you save - the draft agent, it is published to the default environment. When you - create agent versions, you can publish them to custom environments. - You can create a variety of custom environments for: - testing - - development - production - etc. For more information, see the - `versions and environments guide - `__. - - Attributes: - name: - Output only. The unique identifier of this agent environment. - Format: - ``projects//agent/environments/`` - - ``projects//locations//agent/environments/`` - description: - Optional. The developer-provided description for this - environment. The maximum length is 500 characters. If - exceeded, the request is rejected. - agent_version: - Optional. The agent version loaded into this environment. - Format: ``projects//agent/versions/``. - state: - Output only. The state of this environment. This field is - read-only, i.e., it cannot be set by create and update - methods. - update_time: - Output only. The last update time of this environment. This - field is read-only, i.e., it cannot be set by create and - update methods. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Environment) - }, -) -_sym_db.RegisterMessage(Environment) - -ListEnvironmentsRequest = _reflection.GeneratedProtocolMessageType( - "ListEnvironmentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTENVIRONMENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.environment_pb2", - "__doc__": """The request message for [Environments.ListEnvironments][google.cloud.d - ialogflow.v2beta1.Environments.ListEnvironments]. - - Attributes: - parent: - Required. The agent to list all environments from. Format: - - ``projects//agent`` - - \`projects//locations//agent - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest) - }, -) -_sym_db.RegisterMessage(ListEnvironmentsRequest) - -ListEnvironmentsResponse = _reflection.GeneratedProtocolMessageType( - "ListEnvironmentsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTENVIRONMENTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.environment_pb2", - "__doc__": """The response message for [Environments.ListEnvironments][google.cloud. - dialogflow.v2beta1.Environments.ListEnvironments]. - - Attributes: - environments: - The list of agent environments. There will be a maximum number - of items returned based on the page_size field in the request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse) - }, -) -_sym_db.RegisterMessage(ListEnvironmentsResponse) - - -DESCRIPTOR._options = None -_ENVIRONMENT.fields_by_name["name"]._options = None -_ENVIRONMENT.fields_by_name["description"]._options = None -_ENVIRONMENT.fields_by_name["agent_version"]._options = None -_ENVIRONMENT.fields_by_name["state"]._options = None -_ENVIRONMENT.fields_by_name["update_time"]._options = None -_ENVIRONMENT._options = None -_LISTENVIRONMENTSREQUEST.fields_by_name["parent"]._options = None -_LISTENVIRONMENTSREQUEST.fields_by_name["page_size"]._options = None -_LISTENVIRONMENTSREQUEST.fields_by_name["page_token"]._options = None - -_ENVIRONMENTS = _descriptor.ServiceDescriptor( - name="Environments", - full_name="google.cloud.dialogflow.v2beta1.Environments", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=1082, - serialized_end=1485, - methods=[ - _descriptor.MethodDescriptor( - name="ListEnvironments", - full_name="google.cloud.dialogflow.v2beta1.Environments.ListEnvironments", - index=0, - containing_service=None, - input_type=_LISTENVIRONMENTSREQUEST, - output_type=_LISTENVIRONMENTSRESPONSE, - serialized_options=b"\202\323\344\223\002p\022//v2beta1/{parent=projects/*/agent}/environmentsZ=\022;/v2beta1/{parent=projects/*/locations/*/agent}/environments\332A\006parent", - create_key=_descriptor._internal_create_key, - ) - ], -) -_sym_db.RegisterServiceDescriptor(_ENVIRONMENTS) - -DESCRIPTOR.services_by_name["Environments"] = _ENVIRONMENTS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/environment_pb2_grpc.py b/dialogflow_v2beta1/proto/environment_pb2_grpc.py deleted file mode 100644 index 311b1e87c..000000000 --- a/dialogflow_v2beta1/proto/environment_pb2_grpc.py +++ /dev/null @@ -1,83 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2beta1.proto import ( - environment_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_environment__pb2, -) - - -class EnvironmentsStub(object): - """Service for managing [Environments][google.cloud.dialogflow.v2beta1.Environment]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListEnvironments = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Environments/ListEnvironments", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_environment__pb2.ListEnvironmentsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_environment__pb2.ListEnvironmentsResponse.FromString, - ) - - -class EnvironmentsServicer(object): - """Service for managing [Environments][google.cloud.dialogflow.v2beta1.Environment]. - """ - - def ListEnvironments(self, request, context): - """Returns the list of all non-draft environments of the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_EnvironmentsServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListEnvironments": grpc.unary_unary_rpc_method_handler( - servicer.ListEnvironments, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_environment__pb2.ListEnvironmentsRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_environment__pb2.ListEnvironmentsResponse.SerializeToString, - ) - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2beta1.Environments", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Environments(object): - """Service for managing [Environments][google.cloud.dialogflow.v2beta1.Environment]. - """ - - @staticmethod - def ListEnvironments( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Environments/ListEnvironments", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_environment__pb2.ListEnvironmentsRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_environment__pb2.ListEnvironmentsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2beta1/proto/gcs_pb2.py b/dialogflow_v2beta1/proto/gcs_pb2.py deleted file mode 100644 index 125a0a9e9..000000000 --- a/dialogflow_v2beta1/proto/gcs_pb2.py +++ /dev/null @@ -1,93 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/gcs.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/gcs.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\010GcsProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n/google/cloud/dialogflow_v2beta1/proto/gcs.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto"\x18\n\tGcsSource\x12\x0b\n\x03uri\x18\x01 \x01(\tB\xa6\x01\n#com.google.cloud.dialogflow.v2beta1B\x08GcsProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR], -) - - -_GCSSOURCE = _descriptor.Descriptor( - name="GcsSource", - full_name="google.cloud.dialogflow.v2beta1.GcsSource", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="uri", - full_name="google.cloud.dialogflow.v2beta1.GcsSource.uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=114, - serialized_end=138, -) - -DESCRIPTOR.message_types_by_name["GcsSource"] = _GCSSOURCE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -GcsSource = _reflection.GeneratedProtocolMessageType( - "GcsSource", - (_message.Message,), - { - "DESCRIPTOR": _GCSSOURCE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.gcs_pb2", - "__doc__": """Google Cloud Storage location for single input. - - Attributes: - uri: - Required. The Google Cloud Storage URIs for the inputs. A URI - is of the form: gs://bucket/object-prefix-or-name Whether a - prefix or name is used depends on the use case. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.GcsSource) - }, -) -_sym_db.RegisterMessage(GcsSource) - - -DESCRIPTOR._options = None -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/gcs_pb2_grpc.py b/dialogflow_v2beta1/proto/gcs_pb2_grpc.py deleted file mode 100644 index 8a9393943..000000000 --- a/dialogflow_v2beta1/proto/gcs_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/dialogflow_v2beta1/proto/intent_pb2.py b/dialogflow_v2beta1/proto/intent_pb2.py deleted file mode 100644 index 867267cbc..000000000 --- a/dialogflow_v2beta1/proto/intent_pb2.py +++ /dev/null @@ -1,7499 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/intent.proto -"""Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from dialogflow_v2beta1.proto import ( - audio_config_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2, -) -from dialogflow_v2beta1.proto import ( - context_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/intent.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\013IntentProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n2google/cloud/dialogflow_v2beta1/proto/intent.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x38google/cloud/dialogflow_v2beta1/proto/audio_config.proto\x1a\x33google/cloud/dialogflow_v2beta1/proto/context.proto\x1a#google/longrunning/operations.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/protobuf/struct.proto"\xfdN\n\x06Intent\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12P\n\rwebhook_state\x18\x06 \x01(\x0e\x32\x34.google.cloud.dialogflow.v2beta1.Intent.WebhookStateB\x03\xe0\x41\x01\x12\x15\n\x08priority\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x18\n\x0bis_fallback\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x12\x19\n\nml_enabled\x18\x05 \x01(\x08\x42\x05\x18\x01\xe0\x41\x01\x12\x18\n\x0bml_disabled\x18\x13 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1c\n\x0f\x65nd_interaction\x18\x15 \x01(\x08\x42\x03\xe0\x41\x01\x12 \n\x13input_context_names\x18\x07 \x03(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x65vents\x18\x08 \x03(\tB\x03\xe0\x41\x01\x12U\n\x10training_phrases\x18\t \x03(\x0b\x32\x36.google.cloud.dialogflow.v2beta1.Intent.TrainingPhraseB\x03\xe0\x41\x01\x12\x13\n\x06\x61\x63tion\x18\n \x01(\tB\x03\xe0\x41\x01\x12\x46\n\x0foutput_contexts\x18\x0b \x03(\x0b\x32(.google.cloud.dialogflow.v2beta1.ContextB\x03\xe0\x41\x01\x12\x1b\n\x0ereset_contexts\x18\x0c \x01(\x08\x42\x03\xe0\x41\x01\x12J\n\nparameters\x18\r \x03(\x0b\x32\x31.google.cloud.dialogflow.v2beta1.Intent.ParameterB\x03\xe0\x41\x01\x12\x41\n\x08messages\x18\x0e \x03(\x0b\x32/.google.cloud.dialogflow.v2beta1.Intent.Message\x12\x61\n\x1a\x64\x65\x66\x61ult_response_platforms\x18\x0f \x03(\x0e\x32\x38.google.cloud.dialogflow.v2beta1.Intent.Message.PlatformB\x03\xe0\x41\x01\x12&\n\x19root_followup_intent_name\x18\x10 \x01(\tB\x03\xe0\x41\x03\x12(\n\x1bparent_followup_intent_name\x18\x11 \x01(\tB\x03\xe0\x41\x01\x12]\n\x14\x66ollowup_intent_info\x18\x12 \x03(\x0b\x32:.google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfoB\x03\xe0\x41\x03\x1a\xec\x02\n\x0eTrainingPhrase\x12\x0c\n\x04name\x18\x01 \x01(\t\x12N\n\x04type\x18\x02 \x01(\x0e\x32;.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.TypeB\x03\xe0\x41\x02\x12O\n\x05parts\x18\x03 \x03(\x0b\x32;.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.PartB\x03\xe0\x41\x02\x12\x1e\n\x11times_added_count\x18\x04 \x01(\x05\x42\x03\xe0\x41\x01\x1aN\n\x04Part\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x13\n\x0b\x65ntity_type\x18\x02 \x01(\t\x12\r\n\x05\x61lias\x18\x03 \x01(\t\x12\x14\n\x0cuser_defined\x18\x04 \x01(\x08";\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x45XAMPLE\x10\x01\x12\x10\n\x08TEMPLATE\x10\x02\x1a\x02\x08\x01\x1a\xac\x01\n\tParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t\x12\x15\n\rdefault_value\x18\x04 \x01(\t\x12 \n\x18\x65ntity_type_display_name\x18\x05 \x01(\t\x12\x11\n\tmandatory\x18\x06 \x01(\x08\x12\x0f\n\x07prompts\x18\x07 \x03(\t\x12\x0f\n\x07is_list\x18\x08 \x01(\x08\x1a\xc2@\n\x07Message\x12\x44\n\x04text\x18\x01 \x01(\x0b\x32\x34.google.cloud.dialogflow.v2beta1.Intent.Message.TextH\x00\x12\x46\n\x05image\x18\x02 \x01(\x0b\x32\x35.google.cloud.dialogflow.v2beta1.Intent.Message.ImageH\x00\x12U\n\rquick_replies\x18\x03 \x01(\x0b\x32<.google.cloud.dialogflow.v2beta1.Intent.Message.QuickRepliesH\x00\x12\x44\n\x04\x63\x61rd\x18\x04 \x01(\x0b\x32\x34.google.cloud.dialogflow.v2beta1.Intent.Message.CardH\x00\x12*\n\x07payload\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12[\n\x10simple_responses\x18\x07 \x01(\x0b\x32?.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponsesH\x00\x12O\n\nbasic_card\x18\x08 \x01(\x0b\x32\x39.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCardH\x00\x12R\n\x0bsuggestions\x18\t \x01(\x0b\x32;.google.cloud.dialogflow.v2beta1.Intent.Message.SuggestionsH\x00\x12`\n\x13link_out_suggestion\x18\n \x01(\x0b\x32\x41.google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestionH\x00\x12Q\n\x0blist_select\x18\x0b \x01(\x0b\x32:.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelectH\x00\x12Y\n\x0f\x63\x61rousel_select\x18\x0c \x01(\x0b\x32>.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelectH\x00\x12\x62\n\x14telephony_play_audio\x18\r \x01(\x0b\x32\x42.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudioH\x00\x12p\n\x1btelephony_synthesize_speech\x18\x0e \x01(\x0b\x32I.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeechH\x00\x12h\n\x17telephony_transfer_call\x18\x0f \x01(\x0b\x32\x45.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCallH\x00\x12K\n\x08rbm_text\x18\x12 \x01(\x0b\x32\x37.google.cloud.dialogflow.v2beta1.Intent.Message.RbmTextH\x00\x12\x65\n\x18rbm_standalone_rich_card\x18\x13 \x01(\x0b\x32\x41.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCardH\x00\x12\x61\n\x16rbm_carousel_rich_card\x18\x14 \x01(\x0b\x32?.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCardH\x00\x12\x62\n\x14\x62rowse_carousel_card\x18\x16 \x01(\x0b\x32\x42.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCardH\x00\x12O\n\ntable_card\x18\x17 \x01(\x0b\x32\x39.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardH\x00\x12U\n\rmedia_content\x18\x18 \x01(\x0b\x32<.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContentH\x00\x12O\n\x08platform\x18\x06 \x01(\x0e\x32\x38.google.cloud.dialogflow.v2beta1.Intent.Message.PlatformB\x03\xe0\x41\x01\x1a\x14\n\x04Text\x12\x0c\n\x04text\x18\x01 \x03(\t\x1a\x36\n\x05Image\x12\x11\n\timage_uri\x18\x01 \x01(\t\x12\x1a\n\x12\x61\x63\x63\x65ssibility_text\x18\x02 \x01(\t\x1a\x34\n\x0cQuickReplies\x12\r\n\x05title\x18\x01 \x01(\t\x12\x15\n\rquick_replies\x18\x02 \x03(\t\x1a\xb2\x01\n\x04\x43\x61rd\x12\r\n\x05title\x18\x01 \x01(\t\x12\x10\n\x08subtitle\x18\x02 \x01(\t\x12\x11\n\timage_uri\x18\x03 \x01(\t\x12L\n\x07\x62uttons\x18\x04 \x03(\x0b\x32;.google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button\x1a(\n\x06\x42utton\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x10\n\x08postback\x18\x02 \x01(\t\x1aL\n\x0eSimpleResponse\x12\x16\n\x0etext_to_speech\x18\x01 \x01(\t\x12\x0c\n\x04ssml\x18\x02 \x01(\t\x12\x14\n\x0c\x64isplay_text\x18\x03 \x01(\t\x1ak\n\x0fSimpleResponses\x12X\n\x10simple_responses\x18\x01 \x03(\x0b\x32>.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse\x1a\xfe\x02\n\tBasicCard\x12\r\n\x05title\x18\x01 \x01(\t\x12\x10\n\x08subtitle\x18\x02 \x01(\t\x12\x16\n\x0e\x66ormatted_text\x18\x03 \x01(\t\x12\x44\n\x05image\x18\x04 \x01(\x0b\x32\x35.google.cloud.dialogflow.v2beta1.Intent.Message.Image\x12Q\n\x07\x62uttons\x18\x05 \x03(\x0b\x32@.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button\x1a\x9e\x01\n\x06\x42utton\x12\r\n\x05title\x18\x01 \x01(\t\x12g\n\x0fopen_uri_action\x18\x02 \x01(\x0b\x32N.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction\x1a\x1c\n\rOpenUriAction\x12\x0b\n\x03uri\x18\x01 \x01(\t\x1a\x1b\n\nSuggestion\x12\r\n\x05title\x18\x01 \x01(\t\x1a^\n\x0bSuggestions\x12O\n\x0bsuggestions\x18\x01 \x03(\x0b\x32:.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion\x1a:\n\x11LinkOutSuggestion\x12\x18\n\x10\x64\x65stination_name\x18\x01 \x01(\t\x12\x0b\n\x03uri\x18\x02 \x01(\t\x1a\xc3\x02\n\nListSelect\x12\r\n\x05title\x18\x01 \x01(\t\x12N\n\x05items\x18\x02 \x03(\x0b\x32?.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item\x12\x15\n\x08subtitle\x18\x03 \x01(\tB\x03\xe0\x41\x01\x1a\xbe\x01\n\x04Item\x12L\n\x04info\x18\x01 \x01(\x0b\x32>.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo\x12\r\n\x05title\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x44\n\x05image\x18\x04 \x01(\x0b\x32\x35.google.cloud.dialogflow.v2beta1.Intent.Message.Image\x1a\xa5\x02\n\x0e\x43\x61rouselSelect\x12R\n\x05items\x18\x01 \x03(\x0b\x32\x43.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item\x1a\xbe\x01\n\x04Item\x12L\n\x04info\x18\x01 \x01(\x0b\x32>.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo\x12\r\n\x05title\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x44\n\x05image\x18\x04 \x01(\x0b\x32\x35.google.cloud.dialogflow.v2beta1.Intent.Message.Image\x1a/\n\x0eSelectItemInfo\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x10\n\x08synonyms\x18\x02 \x03(\t\x1a\'\n\x12TelephonyPlayAudio\x12\x11\n\taudio_uri\x18\x01 \x01(\t\x1a\x45\n\x19TelephonySynthesizeSpeech\x12\x0e\n\x04text\x18\x01 \x01(\tH\x00\x12\x0e\n\x04ssml\x18\x02 \x01(\tH\x00\x42\x08\n\x06source\x1a-\n\x15TelephonyTransferCall\x12\x14\n\x0cphone_number\x18\x01 \x01(\t\x1an\n\x07RbmText\x12\x0c\n\x04text\x18\x01 \x01(\t\x12U\n\x0erbm_suggestion\x18\x02 \x03(\x0b\x32=.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion\x1a\x87\x02\n\x0fRbmCarouselCard\x12]\n\ncard_width\x18\x01 \x01(\x0e\x32I.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth\x12U\n\rcard_contents\x18\x02 \x03(\x0b\x32>.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent">\n\tCardWidth\x12\x1a\n\x16\x43\x41RD_WIDTH_UNSPECIFIED\x10\x00\x12\t\n\x05SMALL\x10\x01\x12\n\n\x06MEDIUM\x10\x02\x1a\x82\x04\n\x11RbmStandaloneCard\x12k\n\x10\x63\x61rd_orientation\x18\x01 \x01(\x0e\x32Q.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation\x12|\n\x19thumbnail_image_alignment\x18\x02 \x01(\x0e\x32Y.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment\x12T\n\x0c\x63\x61rd_content\x18\x03 \x01(\x0b\x32>.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent"Q\n\x0f\x43\x61rdOrientation\x12 \n\x1c\x43\x41RD_ORIENTATION_UNSPECIFIED\x10\x00\x12\x0e\n\nHORIZONTAL\x10\x01\x12\x0c\n\x08VERTICAL\x10\x02"Y\n\x17ThumbnailImageAlignment\x12)\n%THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED\x10\x00\x12\x08\n\x04LEFT\x10\x01\x12\t\n\x05RIGHT\x10\x02\x1a\xb9\x03\n\x0eRbmCardContent\x12\r\n\x05title\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12V\n\x05media\x18\x03 \x01(\x0b\x32G.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia\x12R\n\x0bsuggestions\x18\x04 \x03(\x0b\x32=.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion\x1a\xd6\x01\n\x08RbmMedia\x12\x10\n\x08\x66ile_uri\x18\x01 \x01(\t\x12\x15\n\rthumbnail_uri\x18\x02 \x01(\t\x12^\n\x06height\x18\x03 \x01(\x0e\x32N.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height"A\n\x06Height\x12\x16\n\x12HEIGHT_UNSPECIFIED\x10\x00\x12\t\n\x05SHORT\x10\x01\x12\n\n\x06MEDIUM\x10\x02\x12\x08\n\x04TALL\x10\x03\x1a\xc7\x01\n\rRbmSuggestion\x12R\n\x05reply\x18\x01 \x01(\x0b\x32\x41.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReplyH\x00\x12T\n\x06\x61\x63tion\x18\x02 \x01(\x0b\x32\x42.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedActionH\x00\x42\x0c\n\nsuggestion\x1a\x38\n\x11RbmSuggestedReply\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x15\n\rpostback_data\x18\x02 \x01(\t\x1a\x9b\x04\n\x12RbmSuggestedAction\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x15\n\rpostback_data\x18\x02 \x01(\t\x12i\n\x04\x64ial\x18\x03 \x01(\x0b\x32Y.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDialH\x00\x12p\n\x08open_url\x18\x04 \x01(\x0b\x32\\.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUriH\x00\x12|\n\x0eshare_location\x18\x05 \x01(\x0b\x32\x62.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocationH\x00\x1a.\n\x16RbmSuggestedActionDial\x12\x14\n\x0cphone_number\x18\x01 \x01(\t\x1a(\n\x19RbmSuggestedActionOpenUri\x12\x0b\n\x03uri\x18\x01 \x01(\t\x1a!\n\x1fRbmSuggestedActionShareLocationB\x08\n\x06\x61\x63tion\x1a\x8e\x04\n\x0cMediaContent\x12\x62\n\nmedia_type\x18\x01 \x01(\x0e\x32N.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType\x12g\n\rmedia_objects\x18\x02 \x03(\x0b\x32P.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject\x1a\xeb\x01\n\x13ResponseMediaObject\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12L\n\x0blarge_image\x18\x03 \x01(\x0b\x32\x35.google.cloud.dialogflow.v2beta1.Intent.Message.ImageH\x00\x12\x45\n\x04icon\x18\x04 \x01(\x0b\x32\x35.google.cloud.dialogflow.v2beta1.Intent.Message.ImageH\x00\x12\x13\n\x0b\x63ontent_url\x18\x05 \x01(\tB\x07\n\x05image"C\n\x11ResponseMediaType\x12#\n\x1fRESPONSE_MEDIA_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05\x41UDIO\x10\x01\x1a\x80\x07\n\x12\x42rowseCarouselCard\x12h\n\x05items\x18\x01 \x03(\x0b\x32Y.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem\x12u\n\x15image_display_options\x18\x02 \x01(\x0e\x32V.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions\x1a\x90\x04\n\x16\x42rowseCarouselCardItem\x12\x80\x01\n\x0fopen_uri_action\x18\x01 \x01(\x0b\x32g.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction\x12\r\n\x05title\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x44\n\x05image\x18\x04 \x01(\x0b\x32\x35.google.cloud.dialogflow.v2beta1.Intent.Message.Image\x12\x0e\n\x06\x66ooter\x18\x05 \x01(\t\x1a\xf8\x01\n\rOpenUrlAction\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x8a\x01\n\rurl_type_hint\x18\x03 \x01(\x0e\x32s.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint"M\n\x0bUrlTypeHint\x12\x1d\n\x19URL_TYPE_HINT_UNSPECIFIED\x10\x00\x12\x0e\n\nAMP_ACTION\x10\x01\x12\x0f\n\x0b\x41MP_CONTENT\x10\x02"v\n\x13ImageDisplayOptions\x12%\n!IMAGE_DISPLAY_OPTIONS_UNSPECIFIED\x10\x00\x12\x08\n\x04GRAY\x10\x01\x12\t\n\x05WHITE\x10\x02\x12\x0b\n\x07\x43ROPPED\x10\x03\x12\x16\n\x12\x42LURRED_BACKGROUND\x10\x04\x1a\xee\x02\n\tTableCard\x12\r\n\x05title\x18\x01 \x01(\t\x12\x10\n\x08subtitle\x18\x02 \x01(\t\x12\x44\n\x05image\x18\x03 \x01(\x0b\x32\x35.google.cloud.dialogflow.v2beta1.Intent.Message.Image\x12[\n\x11\x63olumn_properties\x18\x04 \x03(\x0b\x32@.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties\x12J\n\x04rows\x18\x05 \x03(\x0b\x32<.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow\x12Q\n\x07\x62uttons\x18\x06 \x03(\x0b\x32@.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button\x1a\xfa\x01\n\x10\x43olumnProperties\x12\x0e\n\x06header\x18\x01 \x01(\t\x12r\n\x14horizontal_alignment\x18\x02 \x01(\x0e\x32T.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment"b\n\x13HorizontalAlignment\x12$\n HORIZONTAL_ALIGNMENT_UNSPECIFIED\x10\x00\x12\x0b\n\x07LEADING\x10\x01\x12\n\n\x06\x43\x45NTER\x10\x02\x12\x0c\n\x08TRAILING\x10\x03\x1as\n\x0cTableCardRow\x12L\n\x05\x63\x65lls\x18\x01 \x03(\x0b\x32=.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell\x12\x15\n\rdivider_after\x18\x02 \x01(\x08\x1a\x1d\n\rTableCardCell\x12\x0c\n\x04text\x18\x01 \x01(\t"\xaf\x01\n\x08Platform\x12\x18\n\x14PLATFORM_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x46\x41\x43\x45\x42OOK\x10\x01\x12\t\n\x05SLACK\x10\x02\x12\x0c\n\x08TELEGRAM\x10\x03\x12\x07\n\x03KIK\x10\x04\x12\t\n\x05SKYPE\x10\x05\x12\x08\n\x04LINE\x10\x06\x12\t\n\x05VIBER\x10\x07\x12\x15\n\x11\x41\x43TIONS_ON_GOOGLE\x10\x08\x12\r\n\tTELEPHONY\x10\n\x12\x13\n\x0fGOOGLE_HANGOUTS\x10\x0b\x42\t\n\x07message\x1aW\n\x12\x46ollowupIntentInfo\x12\x1c\n\x14\x66ollowup_intent_name\x18\x01 \x01(\t\x12#\n\x1bparent_followup_intent_name\x18\x02 \x01(\t"t\n\x0cWebhookState\x12\x1d\n\x19WEBHOOK_STATE_UNSPECIFIED\x10\x00\x12\x19\n\x15WEBHOOK_STATE_ENABLED\x10\x01\x12*\n&WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING\x10\x02:\x91\x01\xea\x41\x8d\x01\n dialogflow.googleapis.com/Intent\x12)projects/{project}/agent/intents/{intent}\x12>projects/{project}/locations/{location}/agent/intents/{intent}"\xd3\x01\n\x12ListIntentsRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\x12 dialogflow.googleapis.com/Intent\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12@\n\x0bintent_view\x18\x03 \x01(\x0e\x32+.google.cloud.dialogflow.v2beta1.IntentView\x12\x11\n\tpage_size\x18\x04 \x01(\x05\x12\x12\n\npage_token\x18\x05 \x01(\t"h\n\x13ListIntentsResponse\x12\x38\n\x07intents\x18\x01 \x03(\x0b\x32\'.google.cloud.dialogflow.v2beta1.Intent\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\xa8\x01\n\x10GetIntentRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n dialogflow.googleapis.com/Intent\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12@\n\x0bintent_view\x18\x03 \x01(\x0e\x32+.google.cloud.dialogflow.v2beta1.IntentView"\xeb\x01\n\x13\x43reateIntentRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\x12 dialogflow.googleapis.com/Intent\x12<\n\x06intent\x18\x02 \x01(\x0b\x32\'.google.cloud.dialogflow.v2beta1.IntentB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12@\n\x0bintent_view\x18\x04 \x01(\x0e\x32+.google.cloud.dialogflow.v2beta1.IntentView"\xe2\x01\n\x13UpdateIntentRequest\x12<\n\x06intent\x18\x01 \x01(\x0b\x32\'.google.cloud.dialogflow.v2beta1.IntentB\x03\xe0\x41\x02\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12/\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12@\n\x0bintent_view\x18\x04 \x01(\x0e\x32+.google.cloud.dialogflow.v2beta1.IntentView"M\n\x13\x44\x65leteIntentRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n dialogflow.googleapis.com/Intent"\xdd\x02\n\x19\x42\x61tchUpdateIntentsRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\x12 dialogflow.googleapis.com/Intent\x12\x1a\n\x10intent_batch_uri\x18\x02 \x01(\tH\x00\x12K\n\x13intent_batch_inline\x18\x03 \x01(\x0b\x32,.google.cloud.dialogflow.v2beta1.IntentBatchH\x00\x12\x1a\n\rlanguage_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12/\n\x0bupdate_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12@\n\x0bintent_view\x18\x06 \x01(\x0e\x32+.google.cloud.dialogflow.v2beta1.IntentViewB\x0e\n\x0cintent_batch"V\n\x1a\x42\x61tchUpdateIntentsResponse\x12\x38\n\x07intents\x18\x01 \x03(\x0b\x32\'.google.cloud.dialogflow.v2beta1.Intent"\x94\x01\n\x19\x42\x61tchDeleteIntentsRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\x12 dialogflow.googleapis.com/Intent\x12=\n\x07intents\x18\x02 \x03(\x0b\x32\'.google.cloud.dialogflow.v2beta1.IntentB\x03\xe0\x41\x02"G\n\x0bIntentBatch\x12\x38\n\x07intents\x18\x01 \x03(\x0b\x32\'.google.cloud.dialogflow.v2beta1.Intent*?\n\nIntentView\x12\x1b\n\x17INTENT_VIEW_UNSPECIFIED\x10\x00\x12\x14\n\x10INTENT_VIEW_FULL\x10\x01\x32\xe3\x10\n\x07Intents\x12\x87\x02\n\x0bListIntents\x12\x33.google.cloud.dialogflow.v2beta1.ListIntentsRequest\x1a\x34.google.cloud.dialogflow.v2beta1.ListIntentsResponse"\x8c\x01\x82\xd3\xe4\x93\x02\x66\x12*/v2beta1/{parent=projects/*/agent}/intentsZ8\x12\x36/v2beta1/{parent=projects/*/locations/*/agent}/intents\xda\x41\x06parent\xda\x41\x14parent,language_code\x12\xf2\x01\n\tGetIntent\x12\x31.google.cloud.dialogflow.v2beta1.GetIntentRequest\x1a\'.google.cloud.dialogflow.v2beta1.Intent"\x88\x01\x82\xd3\xe4\x93\x02\x66\x12*/v2beta1/{name=projects/*/agent/intents/*}Z8\x12\x36/v2beta1/{name=projects/*/locations/*/agent/intents/*}\xda\x41\x04name\xda\x41\x12name,language_code\x12\x9a\x02\n\x0c\x43reateIntent\x12\x34.google.cloud.dialogflow.v2beta1.CreateIntentRequest\x1a\'.google.cloud.dialogflow.v2beta1.Intent"\xaa\x01\x82\xd3\xe4\x93\x02v"*/v2beta1/{parent=projects/*/agent}/intents:\x06intentZ@"6/v2beta1/{parent=projects/*/locations/*/agent}/intents:\x06intent\xda\x41\rparent,intent\xda\x41\x1bparent,intent,language_code\x12\xd3\x02\n\x0cUpdateIntent\x12\x34.google.cloud.dialogflow.v2beta1.UpdateIntentRequest\x1a\'.google.cloud.dialogflow.v2beta1.Intent"\xe3\x01\x82\xd3\xe4\x93\x02\x84\x01\x32\x31/v2beta1/{intent.name=projects/*/agent/intents/*}:\x06intentZG2=/v2beta1/{intent.name=projects/*/locations/*/agent/intents/*}:\x06intent\xda\x41\x12intent,update_mask\xda\x41\x06intent\xda\x41\x14intent,language_code\xda\x41 intent,language_code,update_mask\x12\xd1\x01\n\x0c\x44\x65leteIntent\x12\x34.google.cloud.dialogflow.v2beta1.DeleteIntentRequest\x1a\x16.google.protobuf.Empty"s\x82\xd3\xe4\x93\x02\x66**/v2beta1/{name=projects/*/agent/intents/*}Z8*6/v2beta1/{name=projects/*/locations/*/agent/intents/*}\xda\x41\x04name\x12\xd4\x02\n\x12\x42\x61tchUpdateIntents\x12:.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest\x1a\x1d.google.longrunning.Operation"\xe2\x01\x82\xd3\xe4\x93\x02\x84\x01"6/v2beta1/{parent=projects/*/agent}/intents:batchUpdate:\x01*ZG"B/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchUpdate:\x01*\xca\x41T\n:google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse\x12\x16google.protobuf.Struct\x12\xc0\x02\n\x12\x42\x61tchDeleteIntents\x12:.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest\x1a\x1d.google.longrunning.Operation"\xce\x01\x82\xd3\xe4\x93\x02\x84\x01"6/v2beta1/{parent=projects/*/agent}/intents:batchDelete:\x01*ZG"B/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchDelete:\x01*\xda\x41\x0eparent,intents\xca\x41/\n\x15google.protobuf.Empty\x12\x16google.protobuf.Struct\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\xa9\x01\n#com.google.cloud.dialogflow.v2beta1B\x0bIntentProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.DESCRIPTOR, - google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, - google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, - ], -) - -_INTENTVIEW = _descriptor.EnumDescriptor( - name="IntentView", - full_name="google.cloud.dialogflow.v2beta1.IntentView", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="INTENT_VIEW_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INTENT_VIEW_FULL", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=12288, - serialized_end=12351, -) -_sym_db.RegisterEnumDescriptor(_INTENTVIEW) - -IntentView = enum_type_wrapper.EnumTypeWrapper(_INTENTVIEW) -INTENT_VIEW_UNSPECIFIED = 0 -INTENT_VIEW_FULL = 1 - - -_INTENT_TRAININGPHRASE_TYPE = _descriptor.EnumDescriptor( - name="Type", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Type", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EXAMPLE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TEMPLATE", - index=2, - number=2, - serialized_options=b"\010\001", - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1735, - serialized_end=1794, -) -_sym_db.RegisterEnumDescriptor(_INTENT_TRAININGPHRASE_TYPE) - -_INTENT_MESSAGE_RBMCAROUSELCARD_CARDWIDTH = _descriptor.EnumDescriptor( - name="CardWidth", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="CARD_WIDTH_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SMALL", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MEDIUM", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=6018, - serialized_end=6080, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_RBMCAROUSELCARD_CARDWIDTH) - -_INTENT_MESSAGE_RBMSTANDALONECARD_CARDORIENTATION = _descriptor.EnumDescriptor( - name="CardOrientation", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="CARD_ORIENTATION_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="HORIZONTAL", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VERTICAL", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=6425, - serialized_end=6506, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_RBMSTANDALONECARD_CARDORIENTATION) - -_INTENT_MESSAGE_RBMSTANDALONECARD_THUMBNAILIMAGEALIGNMENT = _descriptor.EnumDescriptor( - name="ThumbnailImageAlignment", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LEFT", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="RIGHT", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=6508, - serialized_end=6597, -) -_sym_db.RegisterEnumDescriptor( - _INTENT_MESSAGE_RBMSTANDALONECARD_THUMBNAILIMAGEALIGNMENT -) - -_INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA_HEIGHT = _descriptor.EnumDescriptor( - name="Height", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="HEIGHT_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SHORT", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MEDIUM", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TALL", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=6976, - serialized_end=7041, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA_HEIGHT) - -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIATYPE = _descriptor.EnumDescriptor( - name="ResponseMediaType", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="RESPONSE_MEDIA_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AUDIO", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=8305, - serialized_end=8372, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIATYPE) - -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION_URLTYPEHINT = _descriptor.EnumDescriptor( - name="UrlTypeHint", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="URL_TYPE_HINT_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AMP_ACTION", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AMP_CONTENT", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=9074, - serialized_end=9151, -) -_sym_db.RegisterEnumDescriptor( - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION_URLTYPEHINT -) - -_INTENT_MESSAGE_BROWSECAROUSELCARD_IMAGEDISPLAYOPTIONS = _descriptor.EnumDescriptor( - name="ImageDisplayOptions", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="IMAGE_DISPLAY_OPTIONS_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="GRAY", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WHITE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CROPPED", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BLURRED_BACKGROUND", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=9153, - serialized_end=9271, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_BROWSECAROUSELCARD_IMAGEDISPLAYOPTIONS) - -_INTENT_MESSAGE_COLUMNPROPERTIES_HORIZONTALALIGNMENT = _descriptor.EnumDescriptor( - name="HorizontalAlignment", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="HORIZONTAL_ALIGNMENT_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LEADING", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CENTER", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TRAILING", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=9795, - serialized_end=9893, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_COLUMNPROPERTIES_HORIZONTALALIGNMENT) - -_INTENT_MESSAGE_PLATFORM = _descriptor.EnumDescriptor( - name="Platform", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Platform", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="PLATFORM_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FACEBOOK", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SLACK", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TELEGRAM", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="KIK", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SKYPE", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LINE", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VIBER", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ACTIONS_ON_GOOGLE", - index=8, - number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TELEPHONY", - index=9, - number=10, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="GOOGLE_HANGOUTS", - index=10, - number=11, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=10044, - serialized_end=10219, -) -_sym_db.RegisterEnumDescriptor(_INTENT_MESSAGE_PLATFORM) - -_INTENT_WEBHOOKSTATE = _descriptor.EnumDescriptor( - name="WebhookState", - full_name="google.cloud.dialogflow.v2beta1.Intent.WebhookState", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="WEBHOOK_STATE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WEBHOOK_STATE_ENABLED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=10321, - serialized_end=10437, -) -_sym_db.RegisterEnumDescriptor(_INTENT_WEBHOOKSTATE) - - -_INTENT_TRAININGPHRASE_PART = _descriptor.Descriptor( - name="Part", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.entity_type", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="alias", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.alias", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="user_defined", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.user_defined", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1655, - serialized_end=1733, -) - -_INTENT_TRAININGPHRASE = _descriptor.Descriptor( - name="TrainingPhrase", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="type", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.type", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parts", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.parts", - index=2, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="times_added_count", - full_name="google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.times_added_count", - index=3, - number=4, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_TRAININGPHRASE_PART], - enum_types=[_INTENT_TRAININGPHRASE_TYPE], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1430, - serialized_end=1794, -) - -_INTENT_PARAMETER = _descriptor.Descriptor( - name="Parameter", - full_name="google.cloud.dialogflow.v2beta1.Intent.Parameter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.Intent.Parameter.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.dialogflow.v2beta1.Intent.Parameter.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.cloud.dialogflow.v2beta1.Intent.Parameter.value", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="default_value", - full_name="google.cloud.dialogflow.v2beta1.Intent.Parameter.default_value", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_type_display_name", - full_name="google.cloud.dialogflow.v2beta1.Intent.Parameter.entity_type_display_name", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="mandatory", - full_name="google.cloud.dialogflow.v2beta1.Intent.Parameter.mandatory", - index=5, - number=6, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="prompts", - full_name="google.cloud.dialogflow.v2beta1.Intent.Parameter.prompts", - index=6, - number=7, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_list", - full_name="google.cloud.dialogflow.v2beta1.Intent.Parameter.is_list", - index=7, - number=8, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1797, - serialized_end=1969, -) - -_INTENT_MESSAGE_TEXT = _descriptor.Descriptor( - name="Text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Text", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Text.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3804, - serialized_end=3824, -) - -_INTENT_MESSAGE_IMAGE = _descriptor.Descriptor( - name="Image", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Image", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="image_uri", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Image.image_uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="accessibility_text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Image.accessibility_text", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3826, - serialized_end=3880, -) - -_INTENT_MESSAGE_QUICKREPLIES = _descriptor.Descriptor( - name="QuickReplies", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="quick_replies", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.quick_replies", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3882, - serialized_end=3934, -) - -_INTENT_MESSAGE_CARD_BUTTON = _descriptor.Descriptor( - name="Button", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="postback", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.postback", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4075, - serialized_end=4115, -) - -_INTENT_MESSAGE_CARD = _descriptor.Descriptor( - name="Card", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Card", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Card.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="subtitle", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Card.subtitle", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image_uri", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Card.image_uri", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="buttons", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Card.buttons", - index=3, - number=4, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_CARD_BUTTON], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3937, - serialized_end=4115, -) - -_INTENT_MESSAGE_SIMPLERESPONSE = _descriptor.Descriptor( - name="SimpleResponse", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text_to_speech", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.text_to_speech", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="ssml", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.ssml", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.display_text", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4117, - serialized_end=4193, -) - -_INTENT_MESSAGE_SIMPLERESPONSES = _descriptor.Descriptor( - name="SimpleResponses", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="simple_responses", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.simple_responses", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4195, - serialized_end=4302, -) - -_INTENT_MESSAGE_BASICCARD_BUTTON_OPENURIACTION = _descriptor.Descriptor( - name="OpenUriAction", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="uri", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction.uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4659, - serialized_end=4687, -) - -_INTENT_MESSAGE_BASICCARD_BUTTON = _descriptor.Descriptor( - name="Button", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="open_uri_action", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.open_uri_action", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_BASICCARD_BUTTON_OPENURIACTION], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4529, - serialized_end=4687, -) - -_INTENT_MESSAGE_BASICCARD = _descriptor.Descriptor( - name="BasicCard", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="subtitle", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.subtitle", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="formatted_text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.formatted_text", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.image", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="buttons", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.buttons", - index=4, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_BASICCARD_BUTTON], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4305, - serialized_end=4687, -) - -_INTENT_MESSAGE_SUGGESTION = _descriptor.Descriptor( - name="Suggestion", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4689, - serialized_end=4716, -) - -_INTENT_MESSAGE_SUGGESTIONS = _descriptor.Descriptor( - name="Suggestions", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="suggestions", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.suggestions", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4718, - serialized_end=4812, -) - -_INTENT_MESSAGE_LINKOUTSUGGESTION = _descriptor.Descriptor( - name="LinkOutSuggestion", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="destination_name", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.destination_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="uri", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4814, - serialized_end=4872, -) - -_INTENT_MESSAGE_LISTSELECT_ITEM = _descriptor.Descriptor( - name="Item", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="info", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.info", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.title", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.description", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.image", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5008, - serialized_end=5198, -) - -_INTENT_MESSAGE_LISTSELECT = _descriptor.Descriptor( - name="ListSelect", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="items", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.items", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="subtitle", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.subtitle", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_LISTSELECT_ITEM], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4875, - serialized_end=5198, -) - -_INTENT_MESSAGE_CAROUSELSELECT_ITEM = _descriptor.Descriptor( - name="Item", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="info", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.info", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.title", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.description", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.image", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5008, - serialized_end=5198, -) - -_INTENT_MESSAGE_CAROUSELSELECT = _descriptor.Descriptor( - name="CarouselSelect", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="items", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.items", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_CAROUSELSELECT_ITEM], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5201, - serialized_end=5494, -) - -_INTENT_MESSAGE_SELECTITEMINFO = _descriptor.Descriptor( - name="SelectItemInfo", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="synonyms", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.synonyms", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5496, - serialized_end=5543, -) - -_INTENT_MESSAGE_TELEPHONYPLAYAUDIO = _descriptor.Descriptor( - name="TelephonyPlayAudio", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="audio_uri", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio.audio_uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5545, - serialized_end=5584, -) - -_INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH = _descriptor.Descriptor( - name="TelephonySynthesizeSpeech", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="ssml", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.ssml", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="source", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.source", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=5586, - serialized_end=5655, -) - -_INTENT_MESSAGE_TELEPHONYTRANSFERCALL = _descriptor.Descriptor( - name="TelephonyTransferCall", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="phone_number", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall.phone_number", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5657, - serialized_end=5702, -) - -_INTENT_MESSAGE_RBMTEXT = _descriptor.Descriptor( - name="RbmText", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmText", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="rbm_suggestion", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.rbm_suggestion", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5704, - serialized_end=5814, -) - -_INTENT_MESSAGE_RBMCAROUSELCARD = _descriptor.Descriptor( - name="RbmCarouselCard", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="card_width", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.card_width", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="card_contents", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.card_contents", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_INTENT_MESSAGE_RBMCAROUSELCARD_CARDWIDTH], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5817, - serialized_end=6080, -) - -_INTENT_MESSAGE_RBMSTANDALONECARD = _descriptor.Descriptor( - name="RbmStandaloneCard", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="card_orientation", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.card_orientation", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="thumbnail_image_alignment", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.thumbnail_image_alignment", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="card_content", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.card_content", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[ - _INTENT_MESSAGE_RBMSTANDALONECARD_CARDORIENTATION, - _INTENT_MESSAGE_RBMSTANDALONECARD_THUMBNAILIMAGEALIGNMENT, - ], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6083, - serialized_end=6597, -) - -_INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA = _descriptor.Descriptor( - name="RbmMedia", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="file_uri", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.file_uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="thumbnail_uri", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.thumbnail_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="height", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.height", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA_HEIGHT], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6827, - serialized_end=7041, -) - -_INTENT_MESSAGE_RBMCARDCONTENT = _descriptor.Descriptor( - name="RbmCardContent", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.description", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="media", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.media", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="suggestions", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.suggestions", - index=3, - number=4, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6600, - serialized_end=7041, -) - -_INTENT_MESSAGE_RBMSUGGESTION = _descriptor.Descriptor( - name="RbmSuggestion", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="reply", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.reply", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="action", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.action", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="suggestion", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.suggestion", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=7044, - serialized_end=7243, -) - -_INTENT_MESSAGE_RBMSUGGESTEDREPLY = _descriptor.Descriptor( - name="RbmSuggestedReply", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="postback_data", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.postback_data", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7245, - serialized_end=7301, -) - -_INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONDIAL = _descriptor.Descriptor( - name="RbmSuggestedActionDial", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="phone_number", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial.phone_number", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7710, - serialized_end=7756, -) - -_INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONOPENURI = _descriptor.Descriptor( - name="RbmSuggestedActionOpenUri", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="uri", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri.uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7758, - serialized_end=7798, -) - -_INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONSHARELOCATION = _descriptor.Descriptor( - name="RbmSuggestedActionShareLocation", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7800, - serialized_end=7833, -) - -_INTENT_MESSAGE_RBMSUGGESTEDACTION = _descriptor.Descriptor( - name="RbmSuggestedAction", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="postback_data", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.postback_data", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="dial", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.dial", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="open_url", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.open_url", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="share_location", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.share_location", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONDIAL, - _INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONOPENURI, - _INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONSHARELOCATION, - ], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="action", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.action", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=7304, - serialized_end=7843, -) - -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT = _descriptor.Descriptor( - name="ResponseMediaObject", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.description", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="large_image", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.large_image", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="icon", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.icon", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="content_url", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.content_url", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.image", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=8068, - serialized_end=8303, -) - -_INTENT_MESSAGE_MEDIACONTENT = _descriptor.Descriptor( - name="MediaContent", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="media_type", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.media_type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="media_objects", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.media_objects", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT], - enum_types=[_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIATYPE], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7846, - serialized_end=8372, -) - -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION = _descriptor.Descriptor( - name="OpenUrlAction", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="url", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.url", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="url_type_hint", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.url_type_hint", - index=1, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[ - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION_URLTYPEHINT - ], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8903, - serialized_end=9151, -) - -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM = _descriptor.Descriptor( - name="BrowseCarouselCardItem", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="open_uri_action", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.open_uri_action", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.title", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.description", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.image", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="footer", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.footer", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION - ], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8623, - serialized_end=9151, -) - -_INTENT_MESSAGE_BROWSECAROUSELCARD = _descriptor.Descriptor( - name="BrowseCarouselCard", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="items", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.items", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image_display_options", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.image_display_options", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM], - enum_types=[_INTENT_MESSAGE_BROWSECAROUSELCARD_IMAGEDISPLAYOPTIONS], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8375, - serialized_end=9271, -) - -_INTENT_MESSAGE_TABLECARD = _descriptor.Descriptor( - name="TableCard", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCard", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="subtitle", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.subtitle", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.image", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="column_properties", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.column_properties", - index=3, - number=4, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="rows", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.rows", - index=4, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="buttons", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.buttons", - index=5, - number=6, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=9274, - serialized_end=9640, -) - -_INTENT_MESSAGE_COLUMNPROPERTIES = _descriptor.Descriptor( - name="ColumnProperties", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="header", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.header", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="horizontal_alignment", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.horizontal_alignment", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_INTENT_MESSAGE_COLUMNPROPERTIES_HORIZONTALALIGNMENT], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=9643, - serialized_end=9893, -) - -_INTENT_MESSAGE_TABLECARDROW = _descriptor.Descriptor( - name="TableCardRow", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="cells", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.cells", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="divider_after", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.divider_after", - index=1, - number=2, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=9895, - serialized_end=10010, -) - -_INTENT_MESSAGE_TABLECARDCELL = _descriptor.Descriptor( - name="TableCardCell", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=10012, - serialized_end=10041, -) - -_INTENT_MESSAGE = _descriptor.Descriptor( - name="Message", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.text", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.image", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="quick_replies", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.quick_replies", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="card", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.card", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="payload", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.payload", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="simple_responses", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.simple_responses", - index=5, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="basic_card", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.basic_card", - index=6, - number=8, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="suggestions", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.suggestions", - index=7, - number=9, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="link_out_suggestion", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.link_out_suggestion", - index=8, - number=10, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="list_select", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.list_select", - index=9, - number=11, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="carousel_select", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.carousel_select", - index=10, - number=12, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="telephony_play_audio", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.telephony_play_audio", - index=11, - number=13, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="telephony_synthesize_speech", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.telephony_synthesize_speech", - index=12, - number=14, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="telephony_transfer_call", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.telephony_transfer_call", - index=13, - number=15, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="rbm_text", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.rbm_text", - index=14, - number=18, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="rbm_standalone_rich_card", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.rbm_standalone_rich_card", - index=15, - number=19, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="rbm_carousel_rich_card", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.rbm_carousel_rich_card", - index=16, - number=20, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="browse_carousel_card", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.browse_carousel_card", - index=17, - number=22, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="table_card", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.table_card", - index=18, - number=23, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="media_content", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.media_content", - index=19, - number=24, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="platform", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.platform", - index=20, - number=6, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _INTENT_MESSAGE_TEXT, - _INTENT_MESSAGE_IMAGE, - _INTENT_MESSAGE_QUICKREPLIES, - _INTENT_MESSAGE_CARD, - _INTENT_MESSAGE_SIMPLERESPONSE, - _INTENT_MESSAGE_SIMPLERESPONSES, - _INTENT_MESSAGE_BASICCARD, - _INTENT_MESSAGE_SUGGESTION, - _INTENT_MESSAGE_SUGGESTIONS, - _INTENT_MESSAGE_LINKOUTSUGGESTION, - _INTENT_MESSAGE_LISTSELECT, - _INTENT_MESSAGE_CAROUSELSELECT, - _INTENT_MESSAGE_SELECTITEMINFO, - _INTENT_MESSAGE_TELEPHONYPLAYAUDIO, - _INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH, - _INTENT_MESSAGE_TELEPHONYTRANSFERCALL, - _INTENT_MESSAGE_RBMTEXT, - _INTENT_MESSAGE_RBMCAROUSELCARD, - _INTENT_MESSAGE_RBMSTANDALONECARD, - _INTENT_MESSAGE_RBMCARDCONTENT, - _INTENT_MESSAGE_RBMSUGGESTION, - _INTENT_MESSAGE_RBMSUGGESTEDREPLY, - _INTENT_MESSAGE_RBMSUGGESTEDACTION, - _INTENT_MESSAGE_MEDIACONTENT, - _INTENT_MESSAGE_BROWSECAROUSELCARD, - _INTENT_MESSAGE_TABLECARD, - _INTENT_MESSAGE_COLUMNPROPERTIES, - _INTENT_MESSAGE_TABLECARDROW, - _INTENT_MESSAGE_TABLECARDCELL, - ], - enum_types=[_INTENT_MESSAGE_PLATFORM], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="message", - full_name="google.cloud.dialogflow.v2beta1.Intent.Message.message", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=1972, - serialized_end=10230, -) - -_INTENT_FOLLOWUPINTENTINFO = _descriptor.Descriptor( - name="FollowupIntentInfo", - full_name="google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="followup_intent_name", - full_name="google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.followup_intent_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parent_followup_intent_name", - full_name="google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.parent_followup_intent_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=10232, - serialized_end=10319, -) - -_INTENT = _descriptor.Descriptor( - name="Intent", - full_name="google.cloud.dialogflow.v2beta1.Intent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.Intent.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.dialogflow.v2beta1.Intent.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_state", - full_name="google.cloud.dialogflow.v2beta1.Intent.webhook_state", - index=2, - number=6, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="priority", - full_name="google.cloud.dialogflow.v2beta1.Intent.priority", - index=3, - number=3, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_fallback", - full_name="google.cloud.dialogflow.v2beta1.Intent.is_fallback", - index=4, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="ml_enabled", - full_name="google.cloud.dialogflow.v2beta1.Intent.ml_enabled", - index=5, - number=5, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\030\001\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="ml_disabled", - full_name="google.cloud.dialogflow.v2beta1.Intent.ml_disabled", - index=6, - number=19, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_interaction", - full_name="google.cloud.dialogflow.v2beta1.Intent.end_interaction", - index=7, - number=21, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="input_context_names", - full_name="google.cloud.dialogflow.v2beta1.Intent.input_context_names", - index=8, - number=7, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="events", - full_name="google.cloud.dialogflow.v2beta1.Intent.events", - index=9, - number=8, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="training_phrases", - full_name="google.cloud.dialogflow.v2beta1.Intent.training_phrases", - index=10, - number=9, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="action", - full_name="google.cloud.dialogflow.v2beta1.Intent.action", - index=11, - number=10, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_contexts", - full_name="google.cloud.dialogflow.v2beta1.Intent.output_contexts", - index=12, - number=11, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="reset_contexts", - full_name="google.cloud.dialogflow.v2beta1.Intent.reset_contexts", - index=13, - number=12, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parameters", - full_name="google.cloud.dialogflow.v2beta1.Intent.parameters", - index=14, - number=13, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="messages", - full_name="google.cloud.dialogflow.v2beta1.Intent.messages", - index=15, - number=14, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="default_response_platforms", - full_name="google.cloud.dialogflow.v2beta1.Intent.default_response_platforms", - index=16, - number=15, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="root_followup_intent_name", - full_name="google.cloud.dialogflow.v2beta1.Intent.root_followup_intent_name", - index=17, - number=16, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parent_followup_intent_name", - full_name="google.cloud.dialogflow.v2beta1.Intent.parent_followup_intent_name", - index=18, - number=17, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="followup_intent_info", - full_name="google.cloud.dialogflow.v2beta1.Intent.followup_intent_info", - index=19, - number=18, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _INTENT_TRAININGPHRASE, - _INTENT_PARAMETER, - _INTENT_MESSAGE, - _INTENT_FOLLOWUPINTENTINFO, - ], - enum_types=[_INTENT_WEBHOOKSTATE], - serialized_options=b"\352A\215\001\n dialogflow.googleapis.com/Intent\022)projects/{project}/agent/intents/{intent}\022>projects/{project}/locations/{location}/agent/intents/{intent}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=476, - serialized_end=10585, -) - - -_LISTINTENTSREQUEST = _descriptor.Descriptor( - name="ListIntentsRequest", - full_name="google.cloud.dialogflow.v2beta1.ListIntentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.ListIntentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\022 dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.ListIntentsRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_view", - full_name="google.cloud.dialogflow.v2beta1.ListIntentsRequest.intent_view", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2beta1.ListIntentsRequest.page_size", - index=3, - number=4, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2beta1.ListIntentsRequest.page_token", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=10588, - serialized_end=10799, -) - - -_LISTINTENTSRESPONSE = _descriptor.Descriptor( - name="ListIntentsResponse", - full_name="google.cloud.dialogflow.v2beta1.ListIntentsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="intents", - full_name="google.cloud.dialogflow.v2beta1.ListIntentsResponse.intents", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2beta1.ListIntentsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=10801, - serialized_end=10905, -) - - -_GETINTENTREQUEST = _descriptor.Descriptor( - name="GetIntentRequest", - full_name="google.cloud.dialogflow.v2beta1.GetIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.GetIntentRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\n dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.GetIntentRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_view", - full_name="google.cloud.dialogflow.v2beta1.GetIntentRequest.intent_view", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=10908, - serialized_end=11076, -) - - -_CREATEINTENTREQUEST = _descriptor.Descriptor( - name="CreateIntentRequest", - full_name="google.cloud.dialogflow.v2beta1.CreateIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.CreateIntentRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\022 dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent", - full_name="google.cloud.dialogflow.v2beta1.CreateIntentRequest.intent", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.CreateIntentRequest.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_view", - full_name="google.cloud.dialogflow.v2beta1.CreateIntentRequest.intent_view", - index=3, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=11079, - serialized_end=11314, -) - - -_UPDATEINTENTREQUEST = _descriptor.Descriptor( - name="UpdateIntentRequest", - full_name="google.cloud.dialogflow.v2beta1.UpdateIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="intent", - full_name="google.cloud.dialogflow.v2beta1.UpdateIntentRequest.intent", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.UpdateIntentRequest.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2beta1.UpdateIntentRequest.update_mask", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_view", - full_name="google.cloud.dialogflow.v2beta1.UpdateIntentRequest.intent_view", - index=3, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=11317, - serialized_end=11543, -) - - -_DELETEINTENTREQUEST = _descriptor.Descriptor( - name="DeleteIntentRequest", - full_name="google.cloud.dialogflow.v2beta1.DeleteIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.DeleteIntentRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\n dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=11545, - serialized_end=11622, -) - - -_BATCHUPDATEINTENTSREQUEST = _descriptor.Descriptor( - name="BatchUpdateIntentsRequest", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\022 dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_batch_uri", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.intent_batch_uri", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_batch_inline", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.intent_batch_inline", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.language_code", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.update_mask", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_view", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.intent_view", - index=5, - number=6, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="intent_batch", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.intent_batch", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=11625, - serialized_end=11974, -) - - -_BATCHUPDATEINTENTSRESPONSE = _descriptor.Descriptor( - name="BatchUpdateIntentsResponse", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="intents", - full_name="google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse.intents", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=11976, - serialized_end=12062, -) - - -_BATCHDELETEINTENTSREQUEST = _descriptor.Descriptor( - name="BatchDeleteIntentsRequest", - full_name="google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\340A\002\372A"\022 dialogflow.googleapis.com/Intent', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intents", - full_name="google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest.intents", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=12065, - serialized_end=12213, -) - - -_INTENTBATCH = _descriptor.Descriptor( - name="IntentBatch", - full_name="google.cloud.dialogflow.v2beta1.IntentBatch", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="intents", - full_name="google.cloud.dialogflow.v2beta1.IntentBatch.intents", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=12215, - serialized_end=12286, -) - -_INTENT_TRAININGPHRASE_PART.containing_type = _INTENT_TRAININGPHRASE -_INTENT_TRAININGPHRASE.fields_by_name["type"].enum_type = _INTENT_TRAININGPHRASE_TYPE -_INTENT_TRAININGPHRASE.fields_by_name[ - "parts" -].message_type = _INTENT_TRAININGPHRASE_PART -_INTENT_TRAININGPHRASE.containing_type = _INTENT -_INTENT_TRAININGPHRASE_TYPE.containing_type = _INTENT_TRAININGPHRASE -_INTENT_PARAMETER.containing_type = _INTENT -_INTENT_MESSAGE_TEXT.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_IMAGE.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_QUICKREPLIES.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_CARD_BUTTON.containing_type = _INTENT_MESSAGE_CARD -_INTENT_MESSAGE_CARD.fields_by_name[ - "buttons" -].message_type = _INTENT_MESSAGE_CARD_BUTTON -_INTENT_MESSAGE_CARD.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_SIMPLERESPONSE.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_SIMPLERESPONSES.fields_by_name[ - "simple_responses" -].message_type = _INTENT_MESSAGE_SIMPLERESPONSE -_INTENT_MESSAGE_SIMPLERESPONSES.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_BASICCARD_BUTTON_OPENURIACTION.containing_type = ( - _INTENT_MESSAGE_BASICCARD_BUTTON -) -_INTENT_MESSAGE_BASICCARD_BUTTON.fields_by_name[ - "open_uri_action" -].message_type = _INTENT_MESSAGE_BASICCARD_BUTTON_OPENURIACTION -_INTENT_MESSAGE_BASICCARD_BUTTON.containing_type = _INTENT_MESSAGE_BASICCARD -_INTENT_MESSAGE_BASICCARD.fields_by_name["image"].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_BASICCARD.fields_by_name[ - "buttons" -].message_type = _INTENT_MESSAGE_BASICCARD_BUTTON -_INTENT_MESSAGE_BASICCARD.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_SUGGESTION.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_SUGGESTIONS.fields_by_name[ - "suggestions" -].message_type = _INTENT_MESSAGE_SUGGESTION -_INTENT_MESSAGE_SUGGESTIONS.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_LINKOUTSUGGESTION.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_LISTSELECT_ITEM.fields_by_name[ - "info" -].message_type = _INTENT_MESSAGE_SELECTITEMINFO -_INTENT_MESSAGE_LISTSELECT_ITEM.fields_by_name[ - "image" -].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_LISTSELECT_ITEM.containing_type = _INTENT_MESSAGE_LISTSELECT -_INTENT_MESSAGE_LISTSELECT.fields_by_name[ - "items" -].message_type = _INTENT_MESSAGE_LISTSELECT_ITEM -_INTENT_MESSAGE_LISTSELECT.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_CAROUSELSELECT_ITEM.fields_by_name[ - "info" -].message_type = _INTENT_MESSAGE_SELECTITEMINFO -_INTENT_MESSAGE_CAROUSELSELECT_ITEM.fields_by_name[ - "image" -].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_CAROUSELSELECT_ITEM.containing_type = _INTENT_MESSAGE_CAROUSELSELECT -_INTENT_MESSAGE_CAROUSELSELECT.fields_by_name[ - "items" -].message_type = _INTENT_MESSAGE_CAROUSELSELECT_ITEM -_INTENT_MESSAGE_CAROUSELSELECT.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_SELECTITEMINFO.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_TELEPHONYPLAYAUDIO.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH.oneofs_by_name["source"].fields.append( - _INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH.fields_by_name["text"] -) -_INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH.fields_by_name[ - "text" -].containing_oneof = _INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH.oneofs_by_name["source"] -_INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH.oneofs_by_name["source"].fields.append( - _INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH.fields_by_name["ssml"] -) -_INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH.fields_by_name[ - "ssml" -].containing_oneof = _INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH.oneofs_by_name["source"] -_INTENT_MESSAGE_TELEPHONYTRANSFERCALL.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_RBMTEXT.fields_by_name[ - "rbm_suggestion" -].message_type = _INTENT_MESSAGE_RBMSUGGESTION -_INTENT_MESSAGE_RBMTEXT.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_RBMCAROUSELCARD.fields_by_name[ - "card_width" -].enum_type = _INTENT_MESSAGE_RBMCAROUSELCARD_CARDWIDTH -_INTENT_MESSAGE_RBMCAROUSELCARD.fields_by_name[ - "card_contents" -].message_type = _INTENT_MESSAGE_RBMCARDCONTENT -_INTENT_MESSAGE_RBMCAROUSELCARD.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_RBMCAROUSELCARD_CARDWIDTH.containing_type = ( - _INTENT_MESSAGE_RBMCAROUSELCARD -) -_INTENT_MESSAGE_RBMSTANDALONECARD.fields_by_name[ - "card_orientation" -].enum_type = _INTENT_MESSAGE_RBMSTANDALONECARD_CARDORIENTATION -_INTENT_MESSAGE_RBMSTANDALONECARD.fields_by_name[ - "thumbnail_image_alignment" -].enum_type = _INTENT_MESSAGE_RBMSTANDALONECARD_THUMBNAILIMAGEALIGNMENT -_INTENT_MESSAGE_RBMSTANDALONECARD.fields_by_name[ - "card_content" -].message_type = _INTENT_MESSAGE_RBMCARDCONTENT -_INTENT_MESSAGE_RBMSTANDALONECARD.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_RBMSTANDALONECARD_CARDORIENTATION.containing_type = ( - _INTENT_MESSAGE_RBMSTANDALONECARD -) -_INTENT_MESSAGE_RBMSTANDALONECARD_THUMBNAILIMAGEALIGNMENT.containing_type = ( - _INTENT_MESSAGE_RBMSTANDALONECARD -) -_INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA.fields_by_name[ - "height" -].enum_type = _INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA_HEIGHT -_INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA.containing_type = _INTENT_MESSAGE_RBMCARDCONTENT -_INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA_HEIGHT.containing_type = ( - _INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA -) -_INTENT_MESSAGE_RBMCARDCONTENT.fields_by_name[ - "media" -].message_type = _INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA -_INTENT_MESSAGE_RBMCARDCONTENT.fields_by_name[ - "suggestions" -].message_type = _INTENT_MESSAGE_RBMSUGGESTION -_INTENT_MESSAGE_RBMCARDCONTENT.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_RBMSUGGESTION.fields_by_name[ - "reply" -].message_type = _INTENT_MESSAGE_RBMSUGGESTEDREPLY -_INTENT_MESSAGE_RBMSUGGESTION.fields_by_name[ - "action" -].message_type = _INTENT_MESSAGE_RBMSUGGESTEDACTION -_INTENT_MESSAGE_RBMSUGGESTION.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_RBMSUGGESTION.oneofs_by_name["suggestion"].fields.append( - _INTENT_MESSAGE_RBMSUGGESTION.fields_by_name["reply"] -) -_INTENT_MESSAGE_RBMSUGGESTION.fields_by_name[ - "reply" -].containing_oneof = _INTENT_MESSAGE_RBMSUGGESTION.oneofs_by_name["suggestion"] -_INTENT_MESSAGE_RBMSUGGESTION.oneofs_by_name["suggestion"].fields.append( - _INTENT_MESSAGE_RBMSUGGESTION.fields_by_name["action"] -) -_INTENT_MESSAGE_RBMSUGGESTION.fields_by_name[ - "action" -].containing_oneof = _INTENT_MESSAGE_RBMSUGGESTION.oneofs_by_name["suggestion"] -_INTENT_MESSAGE_RBMSUGGESTEDREPLY.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONDIAL.containing_type = ( - _INTENT_MESSAGE_RBMSUGGESTEDACTION -) -_INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONOPENURI.containing_type = ( - _INTENT_MESSAGE_RBMSUGGESTEDACTION -) -_INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONSHARELOCATION.containing_type = ( - _INTENT_MESSAGE_RBMSUGGESTEDACTION -) -_INTENT_MESSAGE_RBMSUGGESTEDACTION.fields_by_name[ - "dial" -].message_type = _INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONDIAL -_INTENT_MESSAGE_RBMSUGGESTEDACTION.fields_by_name[ - "open_url" -].message_type = _INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONOPENURI -_INTENT_MESSAGE_RBMSUGGESTEDACTION.fields_by_name[ - "share_location" -].message_type = _INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONSHARELOCATION -_INTENT_MESSAGE_RBMSUGGESTEDACTION.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_RBMSUGGESTEDACTION.oneofs_by_name["action"].fields.append( - _INTENT_MESSAGE_RBMSUGGESTEDACTION.fields_by_name["dial"] -) -_INTENT_MESSAGE_RBMSUGGESTEDACTION.fields_by_name[ - "dial" -].containing_oneof = _INTENT_MESSAGE_RBMSUGGESTEDACTION.oneofs_by_name["action"] -_INTENT_MESSAGE_RBMSUGGESTEDACTION.oneofs_by_name["action"].fields.append( - _INTENT_MESSAGE_RBMSUGGESTEDACTION.fields_by_name["open_url"] -) -_INTENT_MESSAGE_RBMSUGGESTEDACTION.fields_by_name[ - "open_url" -].containing_oneof = _INTENT_MESSAGE_RBMSUGGESTEDACTION.oneofs_by_name["action"] -_INTENT_MESSAGE_RBMSUGGESTEDACTION.oneofs_by_name["action"].fields.append( - _INTENT_MESSAGE_RBMSUGGESTEDACTION.fields_by_name["share_location"] -) -_INTENT_MESSAGE_RBMSUGGESTEDACTION.fields_by_name[ - "share_location" -].containing_oneof = _INTENT_MESSAGE_RBMSUGGESTEDACTION.oneofs_by_name["action"] -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name[ - "large_image" -].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name[ - "icon" -].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.containing_type = ( - _INTENT_MESSAGE_MEDIACONTENT -) -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.oneofs_by_name["image"].fields.append( - _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name["large_image"] -) -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name[ - "large_image" -].containing_oneof = _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.oneofs_by_name[ - "image" -] -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.oneofs_by_name["image"].fields.append( - _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name["icon"] -) -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.fields_by_name[ - "icon" -].containing_oneof = _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT.oneofs_by_name[ - "image" -] -_INTENT_MESSAGE_MEDIACONTENT.fields_by_name[ - "media_type" -].enum_type = _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIATYPE -_INTENT_MESSAGE_MEDIACONTENT.fields_by_name[ - "media_objects" -].message_type = _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT -_INTENT_MESSAGE_MEDIACONTENT.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIATYPE.containing_type = ( - _INTENT_MESSAGE_MEDIACONTENT -) -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION.fields_by_name[ - "url_type_hint" -].enum_type = ( - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION_URLTYPEHINT -) -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION.containing_type = ( - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM -) -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION_URLTYPEHINT.containing_type = ( - _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION -) -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM.fields_by_name[ - "open_uri_action" -].message_type = _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM.fields_by_name[ - "image" -].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM.containing_type = ( - _INTENT_MESSAGE_BROWSECAROUSELCARD -) -_INTENT_MESSAGE_BROWSECAROUSELCARD.fields_by_name[ - "items" -].message_type = _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM -_INTENT_MESSAGE_BROWSECAROUSELCARD.fields_by_name[ - "image_display_options" -].enum_type = _INTENT_MESSAGE_BROWSECAROUSELCARD_IMAGEDISPLAYOPTIONS -_INTENT_MESSAGE_BROWSECAROUSELCARD.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_BROWSECAROUSELCARD_IMAGEDISPLAYOPTIONS.containing_type = ( - _INTENT_MESSAGE_BROWSECAROUSELCARD -) -_INTENT_MESSAGE_TABLECARD.fields_by_name["image"].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE_TABLECARD.fields_by_name[ - "column_properties" -].message_type = _INTENT_MESSAGE_COLUMNPROPERTIES -_INTENT_MESSAGE_TABLECARD.fields_by_name[ - "rows" -].message_type = _INTENT_MESSAGE_TABLECARDROW -_INTENT_MESSAGE_TABLECARD.fields_by_name[ - "buttons" -].message_type = _INTENT_MESSAGE_BASICCARD_BUTTON -_INTENT_MESSAGE_TABLECARD.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_COLUMNPROPERTIES.fields_by_name[ - "horizontal_alignment" -].enum_type = _INTENT_MESSAGE_COLUMNPROPERTIES_HORIZONTALALIGNMENT -_INTENT_MESSAGE_COLUMNPROPERTIES.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_COLUMNPROPERTIES_HORIZONTALALIGNMENT.containing_type = ( - _INTENT_MESSAGE_COLUMNPROPERTIES -) -_INTENT_MESSAGE_TABLECARDROW.fields_by_name[ - "cells" -].message_type = _INTENT_MESSAGE_TABLECARDCELL -_INTENT_MESSAGE_TABLECARDROW.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE_TABLECARDCELL.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE.fields_by_name["text"].message_type = _INTENT_MESSAGE_TEXT -_INTENT_MESSAGE.fields_by_name["image"].message_type = _INTENT_MESSAGE_IMAGE -_INTENT_MESSAGE.fields_by_name[ - "quick_replies" -].message_type = _INTENT_MESSAGE_QUICKREPLIES -_INTENT_MESSAGE.fields_by_name["card"].message_type = _INTENT_MESSAGE_CARD -_INTENT_MESSAGE.fields_by_name[ - "payload" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_INTENT_MESSAGE.fields_by_name[ - "simple_responses" -].message_type = _INTENT_MESSAGE_SIMPLERESPONSES -_INTENT_MESSAGE.fields_by_name["basic_card"].message_type = _INTENT_MESSAGE_BASICCARD -_INTENT_MESSAGE.fields_by_name["suggestions"].message_type = _INTENT_MESSAGE_SUGGESTIONS -_INTENT_MESSAGE.fields_by_name[ - "link_out_suggestion" -].message_type = _INTENT_MESSAGE_LINKOUTSUGGESTION -_INTENT_MESSAGE.fields_by_name["list_select"].message_type = _INTENT_MESSAGE_LISTSELECT -_INTENT_MESSAGE.fields_by_name[ - "carousel_select" -].message_type = _INTENT_MESSAGE_CAROUSELSELECT -_INTENT_MESSAGE.fields_by_name[ - "telephony_play_audio" -].message_type = _INTENT_MESSAGE_TELEPHONYPLAYAUDIO -_INTENT_MESSAGE.fields_by_name[ - "telephony_synthesize_speech" -].message_type = _INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH -_INTENT_MESSAGE.fields_by_name[ - "telephony_transfer_call" -].message_type = _INTENT_MESSAGE_TELEPHONYTRANSFERCALL -_INTENT_MESSAGE.fields_by_name["rbm_text"].message_type = _INTENT_MESSAGE_RBMTEXT -_INTENT_MESSAGE.fields_by_name[ - "rbm_standalone_rich_card" -].message_type = _INTENT_MESSAGE_RBMSTANDALONECARD -_INTENT_MESSAGE.fields_by_name[ - "rbm_carousel_rich_card" -].message_type = _INTENT_MESSAGE_RBMCAROUSELCARD -_INTENT_MESSAGE.fields_by_name[ - "browse_carousel_card" -].message_type = _INTENT_MESSAGE_BROWSECAROUSELCARD -_INTENT_MESSAGE.fields_by_name["table_card"].message_type = _INTENT_MESSAGE_TABLECARD -_INTENT_MESSAGE.fields_by_name[ - "media_content" -].message_type = _INTENT_MESSAGE_MEDIACONTENT -_INTENT_MESSAGE.fields_by_name["platform"].enum_type = _INTENT_MESSAGE_PLATFORM -_INTENT_MESSAGE.containing_type = _INTENT -_INTENT_MESSAGE_PLATFORM.containing_type = _INTENT_MESSAGE -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["text"] -) -_INTENT_MESSAGE.fields_by_name[ - "text" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["image"] -) -_INTENT_MESSAGE.fields_by_name[ - "image" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["quick_replies"] -) -_INTENT_MESSAGE.fields_by_name[ - "quick_replies" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["card"] -) -_INTENT_MESSAGE.fields_by_name[ - "card" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["payload"] -) -_INTENT_MESSAGE.fields_by_name[ - "payload" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["simple_responses"] -) -_INTENT_MESSAGE.fields_by_name[ - "simple_responses" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["basic_card"] -) -_INTENT_MESSAGE.fields_by_name[ - "basic_card" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["suggestions"] -) -_INTENT_MESSAGE.fields_by_name[ - "suggestions" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["link_out_suggestion"] -) -_INTENT_MESSAGE.fields_by_name[ - "link_out_suggestion" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["list_select"] -) -_INTENT_MESSAGE.fields_by_name[ - "list_select" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["carousel_select"] -) -_INTENT_MESSAGE.fields_by_name[ - "carousel_select" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["telephony_play_audio"] -) -_INTENT_MESSAGE.fields_by_name[ - "telephony_play_audio" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["telephony_synthesize_speech"] -) -_INTENT_MESSAGE.fields_by_name[ - "telephony_synthesize_speech" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["telephony_transfer_call"] -) -_INTENT_MESSAGE.fields_by_name[ - "telephony_transfer_call" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["rbm_text"] -) -_INTENT_MESSAGE.fields_by_name[ - "rbm_text" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["rbm_standalone_rich_card"] -) -_INTENT_MESSAGE.fields_by_name[ - "rbm_standalone_rich_card" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["rbm_carousel_rich_card"] -) -_INTENT_MESSAGE.fields_by_name[ - "rbm_carousel_rich_card" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["browse_carousel_card"] -) -_INTENT_MESSAGE.fields_by_name[ - "browse_carousel_card" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["table_card"] -) -_INTENT_MESSAGE.fields_by_name[ - "table_card" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_MESSAGE.oneofs_by_name["message"].fields.append( - _INTENT_MESSAGE.fields_by_name["media_content"] -) -_INTENT_MESSAGE.fields_by_name[ - "media_content" -].containing_oneof = _INTENT_MESSAGE.oneofs_by_name["message"] -_INTENT_FOLLOWUPINTENTINFO.containing_type = _INTENT -_INTENT.fields_by_name["webhook_state"].enum_type = _INTENT_WEBHOOKSTATE -_INTENT.fields_by_name["training_phrases"].message_type = _INTENT_TRAININGPHRASE -_INTENT.fields_by_name[ - "output_contexts" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2._CONTEXT -) -_INTENT.fields_by_name["parameters"].message_type = _INTENT_PARAMETER -_INTENT.fields_by_name["messages"].message_type = _INTENT_MESSAGE -_INTENT.fields_by_name[ - "default_response_platforms" -].enum_type = _INTENT_MESSAGE_PLATFORM -_INTENT.fields_by_name["followup_intent_info"].message_type = _INTENT_FOLLOWUPINTENTINFO -_INTENT_WEBHOOKSTATE.containing_type = _INTENT -_LISTINTENTSREQUEST.fields_by_name["intent_view"].enum_type = _INTENTVIEW -_LISTINTENTSRESPONSE.fields_by_name["intents"].message_type = _INTENT -_GETINTENTREQUEST.fields_by_name["intent_view"].enum_type = _INTENTVIEW -_CREATEINTENTREQUEST.fields_by_name["intent"].message_type = _INTENT -_CREATEINTENTREQUEST.fields_by_name["intent_view"].enum_type = _INTENTVIEW -_UPDATEINTENTREQUEST.fields_by_name["intent"].message_type = _INTENT -_UPDATEINTENTREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_UPDATEINTENTREQUEST.fields_by_name["intent_view"].enum_type = _INTENTVIEW -_BATCHUPDATEINTENTSREQUEST.fields_by_name[ - "intent_batch_inline" -].message_type = _INTENTBATCH -_BATCHUPDATEINTENTSREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_BATCHUPDATEINTENTSREQUEST.fields_by_name["intent_view"].enum_type = _INTENTVIEW -_BATCHUPDATEINTENTSREQUEST.oneofs_by_name["intent_batch"].fields.append( - _BATCHUPDATEINTENTSREQUEST.fields_by_name["intent_batch_uri"] -) -_BATCHUPDATEINTENTSREQUEST.fields_by_name[ - "intent_batch_uri" -].containing_oneof = _BATCHUPDATEINTENTSREQUEST.oneofs_by_name["intent_batch"] -_BATCHUPDATEINTENTSREQUEST.oneofs_by_name["intent_batch"].fields.append( - _BATCHUPDATEINTENTSREQUEST.fields_by_name["intent_batch_inline"] -) -_BATCHUPDATEINTENTSREQUEST.fields_by_name[ - "intent_batch_inline" -].containing_oneof = _BATCHUPDATEINTENTSREQUEST.oneofs_by_name["intent_batch"] -_BATCHUPDATEINTENTSRESPONSE.fields_by_name["intents"].message_type = _INTENT -_BATCHDELETEINTENTSREQUEST.fields_by_name["intents"].message_type = _INTENT -_INTENTBATCH.fields_by_name["intents"].message_type = _INTENT -DESCRIPTOR.message_types_by_name["Intent"] = _INTENT -DESCRIPTOR.message_types_by_name["ListIntentsRequest"] = _LISTINTENTSREQUEST -DESCRIPTOR.message_types_by_name["ListIntentsResponse"] = _LISTINTENTSRESPONSE -DESCRIPTOR.message_types_by_name["GetIntentRequest"] = _GETINTENTREQUEST -DESCRIPTOR.message_types_by_name["CreateIntentRequest"] = _CREATEINTENTREQUEST -DESCRIPTOR.message_types_by_name["UpdateIntentRequest"] = _UPDATEINTENTREQUEST -DESCRIPTOR.message_types_by_name["DeleteIntentRequest"] = _DELETEINTENTREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchUpdateIntentsRequest" -] = _BATCHUPDATEINTENTSREQUEST -DESCRIPTOR.message_types_by_name[ - "BatchUpdateIntentsResponse" -] = _BATCHUPDATEINTENTSRESPONSE -DESCRIPTOR.message_types_by_name[ - "BatchDeleteIntentsRequest" -] = _BATCHDELETEINTENTSREQUEST -DESCRIPTOR.message_types_by_name["IntentBatch"] = _INTENTBATCH -DESCRIPTOR.enum_types_by_name["IntentView"] = _INTENTVIEW -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Intent = _reflection.GeneratedProtocolMessageType( - "Intent", - (_message.Message,), - { - "TrainingPhrase": _reflection.GeneratedProtocolMessageType( - "TrainingPhrase", - (_message.Message,), - { - "Part": _reflection.GeneratedProtocolMessageType( - "Part", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_TRAININGPHRASE_PART, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Represents a part of a training phrase. - - Attributes: - text: - Required. The text for this part. - entity_type: - Optional. The entity type name prefixed with ``@``. This field - is required for annotated parts of the training phrase. - alias: - Optional. The parameter name for the value extracted from the - annotated part of the example. This field is required for - annotated parts of the training phrase. - user_defined: - Optional. Indicates whether the text was manually annotated. - This field is set to true when the Dialogflow Console is used - to manually annotate the part. When creating an annotated part - with the API, you must set this to true. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part) - }, - ), - "DESCRIPTOR": _INTENT_TRAININGPHRASE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Represents an example that the agent is trained on. - - Attributes: - name: - Output only. The unique identifier of this training phrase. - type: - Required. The type of the training phrase. - parts: - Required. The ordered list of training phrase parts. The parts - are concatenated in order to form the training phrase. Note: - The API does not automatically annotate training phrases like - the Dialogflow Console does. Note: Do not forget to include - whitespace at part boundaries, so the training phrase is well - formatted when the parts are concatenated. If the training - phrase does not need to be annotated with parameters, you just - need a single part with only the [Part.text][google.cloud.dial - ogflow.v2beta1.Intent.TrainingPhrase.Part.text] field set. If - you want to annotate the training phrase, you must create - multiple parts, where the fields of each part are populated in - one of two ways: - ``Part.text`` is set to a part of the - phrase that has no parameters. - ``Part.text`` is set to a - part of the phrase that you want to annotate, and the - ``entity_type``, ``alias``, and ``user_defined`` fields are - all set. - times_added_count: - Optional. Indicates how many times this example was added to - the intent. Each time a developer adds an existing sample by - editing an intent or training, this counter is increased. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase) - }, - ), - "Parameter": _reflection.GeneratedProtocolMessageType( - "Parameter", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_PARAMETER, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Represents intent parameters. - - Attributes: - name: - The unique identifier of this parameter. - display_name: - Required. The name of the parameter. - value: - Optional. The definition of the parameter value. It can be: - - a constant string, - a parameter value defined as - ``$parameter_name``, - an original parameter value defined as - ``$parameter_name.original``, - a parameter value from some - context defined as ``#context_name.parameter_name``. - default_value: - Optional. The default value to use when the ``value`` yields - an empty result. Default values can be extracted from contexts - by using the following syntax: - ``#context_name.parameter_name``. - entity_type_display_name: - Optional. The name of the entity type, prefixed with ``@``, - that describes values of the parameter. If the parameter is - required, this must be provided. - mandatory: - Optional. Indicates whether the parameter is required. That - is, whether the intent cannot be completed without collecting - the parameter value. - prompts: - Optional. The collection of prompts that the agent can present - to the user in order to collect a value for the parameter. - is_list: - Optional. Indicates whether the parameter represents a list of - values. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Parameter) - }, - ), - "Message": _reflection.GeneratedProtocolMessageType( - "Message", - (_message.Message,), - { - "Text": _reflection.GeneratedProtocolMessageType( - "Text", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TEXT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The text response message. - - Attributes: - text: - Optional. The collection of the agent’s responses. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.Text) - }, - ), - "Image": _reflection.GeneratedProtocolMessageType( - "Image", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_IMAGE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The image response message. - - Attributes: - image_uri: - Optional. The public URI to an image file. - accessibility_text: - A text description of the image to be used for accessibility, - e.g., screen readers. Required if image_uri is set for - CarouselSelect. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.Image) - }, - ), - "QuickReplies": _reflection.GeneratedProtocolMessageType( - "QuickReplies", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_QUICKREPLIES, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The quick replies response message. - - Attributes: - title: - Optional. The title of the collection of quick replies. - quick_replies: - Optional. The collection of quick replies. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies) - }, - ), - "Card": _reflection.GeneratedProtocolMessageType( - "Card", - (_message.Message,), - { - "Button": _reflection.GeneratedProtocolMessageType( - "Button", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_CARD_BUTTON, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Optional. Contains information about a button. - - Attributes: - text: - Optional. The text to show on the button. - postback: - Optional. The text to send back to the Dialogflow API or a URI - to open. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_CARD, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The card response message. - - Attributes: - title: - Optional. The title of the card. - subtitle: - Optional. The subtitle of the card. - image_uri: - Optional. The public URI to an image file for the card. - buttons: - Optional. The collection of card buttons. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.Card) - }, - ), - "SimpleResponse": _reflection.GeneratedProtocolMessageType( - "SimpleResponse", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_SIMPLERESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The simple response message containing speech or text. - - Attributes: - text_to_speech: - One of text_to_speech or ssml must be provided. The plain text - of the speech output. Mutually exclusive with ssml. - ssml: - One of text_to_speech or ssml must be provided. Structured - spoken response to the user in the SSML format. Mutually - exclusive with text_to_speech. - display_text: - Optional. The text to display. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse) - }, - ), - "SimpleResponses": _reflection.GeneratedProtocolMessageType( - "SimpleResponses", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_SIMPLERESPONSES, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The collection of simple response candidates. This message in - ``QueryResult.fulfillment_messages`` and - ``WebhookResponse.fulfillment_messages`` should contain only one - ``SimpleResponse``. - - Attributes: - simple_responses: - Required. The list of simple responses. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses) - }, - ), - "BasicCard": _reflection.GeneratedProtocolMessageType( - "BasicCard", - (_message.Message,), - { - "Button": _reflection.GeneratedProtocolMessageType( - "Button", - (_message.Message,), - { - "OpenUriAction": _reflection.GeneratedProtocolMessageType( - "OpenUriAction", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_BASICCARD_BUTTON_OPENURIACTION, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Opens the given URI. - - Attributes: - uri: - Required. The HTTP or HTTPS scheme URI. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_BASICCARD_BUTTON, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The button object that appears at the bottom of a card. - - Attributes: - title: - Required. The title of the button. - open_uri_action: - Required. Action to take when a user taps on the button. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_BASICCARD, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The basic card message. Useful for displaying information. - - Attributes: - title: - Optional. The title of the card. - subtitle: - Optional. The subtitle of the card. - formatted_text: - Required, unless image is present. The body text of the card. - image: - Optional. The image for the card. - buttons: - Optional. The collection of card buttons. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard) - }, - ), - "Suggestion": _reflection.GeneratedProtocolMessageType( - "Suggestion", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_SUGGESTION, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The suggestion chip message that the user can tap to quickly post a - reply to the conversation. - - Attributes: - title: - Required. The text shown the in the suggestion chip. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion) - }, - ), - "Suggestions": _reflection.GeneratedProtocolMessageType( - "Suggestions", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_SUGGESTIONS, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The collection of suggestions. - - Attributes: - suggestions: - Required. The list of suggested replies. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions) - }, - ), - "LinkOutSuggestion": _reflection.GeneratedProtocolMessageType( - "LinkOutSuggestion", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_LINKOUTSUGGESTION, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The suggestion chip message that allows the user to jump out to the - app or website associated with this agent. - - Attributes: - destination_name: - Required. The name of the app or site this chip is linking to. - uri: - Required. The URI of the app or site to open when the user - taps the suggestion chip. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion) - }, - ), - "ListSelect": _reflection.GeneratedProtocolMessageType( - "ListSelect", - (_message.Message,), - { - "Item": _reflection.GeneratedProtocolMessageType( - "Item", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_LISTSELECT_ITEM, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """An item in the list. - - Attributes: - info: - Required. Additional information about this option. - title: - Required. The title of the list item. - description: - Optional. The main text describing the item. - image: - Optional. The image to display. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_LISTSELECT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The card for presenting a list of options to select from. - - Attributes: - title: - Optional. The overall title of the list. - items: - Required. List items. - subtitle: - Optional. Subtitle of the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect) - }, - ), - "CarouselSelect": _reflection.GeneratedProtocolMessageType( - "CarouselSelect", - (_message.Message,), - { - "Item": _reflection.GeneratedProtocolMessageType( - "Item", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_CAROUSELSELECT_ITEM, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """An item in the carousel. - - Attributes: - info: - Required. Additional info about the option item. - title: - Required. Title of the carousel item. - description: - Optional. The body text of the card. - image: - Optional. The image to display. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_CAROUSELSELECT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The card for presenting a carousel of options to select from. - - Attributes: - items: - Required. Carousel items. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect) - }, - ), - "SelectItemInfo": _reflection.GeneratedProtocolMessageType( - "SelectItemInfo", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_SELECTITEMINFO, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Additional info about the select item for when it is triggered in a - dialog. - - Attributes: - key: - Required. A unique key that will be sent back to the agent if - this response is given. - synonyms: - Optional. A list of synonyms that can also be used to trigger - this item in dialog. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo) - }, - ), - "TelephonyPlayAudio": _reflection.GeneratedProtocolMessageType( - "TelephonyPlayAudio", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TELEPHONYPLAYAUDIO, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Plays audio from a file in Telephony Gateway. - - Attributes: - audio_uri: - Required. URI to a Google Cloud Storage object containing the - audio to play, e.g., “gs://bucket/object”. The object must - contain a single channel (mono) of linear PCM audio (2 bytes / - sample) at 8kHz. This object must be readable by the - ``service-@gcp-sa- - dialogflow.iam.gserviceaccount.com`` service account where is - the number of the Telephony Gateway project (usually the same - as the Dialogflow agent project). If the Google Cloud Storage - bucket is in the Telephony Gateway project, this permission is - added by default when enabling the Dialogflow V2 API. For - audio from other sources, consider using the - ``TelephonySynthesizeSpeech`` message with SSML. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio) - }, - ), - "TelephonySynthesizeSpeech": _reflection.GeneratedProtocolMessageType( - "TelephonySynthesizeSpeech", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TELEPHONYSYNTHESIZESPEECH, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Synthesizes speech and plays back the synthesized audio to the caller - in Telephony Gateway. Telephony Gateway takes the synthesizer - settings from ``DetectIntentResponse.output_audio_config`` which can - either be set at request-level or can come from the agent-level - synthesizer config. - - Attributes: - source: - Required. The source to be synthesized. - text: - The raw text to be synthesized. - ssml: - The SSML to be synthesized. For more information, see `SSML - `__. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech) - }, - ), - "TelephonyTransferCall": _reflection.GeneratedProtocolMessageType( - "TelephonyTransferCall", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TELEPHONYTRANSFERCALL, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Transfers the call in Telephony Gateway. - - Attributes: - phone_number: - Required. The phone number to transfer the call to in `E.164 - format `__. We currently - only allow transferring to US numbers (+1xxxyyyzzzz). - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall) - }, - ), - "RbmText": _reflection.GeneratedProtocolMessageType( - "RbmText", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_RBMTEXT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Rich Business Messaging (RBM) text response with suggestions. - - Attributes: - text: - Required. Text sent and displayed to the user. - rbm_suggestion: - Optional. One or more suggestions to show to the user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmText) - }, - ), - "RbmCarouselCard": _reflection.GeneratedProtocolMessageType( - "RbmCarouselCard", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_RBMCAROUSELCARD, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Carousel Rich Business Messaging (RBM) rich card. Rich cards allow - you to respond to users with more vivid content, e.g. with media and - suggestions. If you want to show a single card with more control over - the layout, please use [RbmStandaloneCard][google.cloud.dialogflow.v2b - eta1.Intent.Message.RbmStandaloneCard] instead. - - Attributes: - card_width: - Required. The width of the cards in the carousel. - card_contents: - Required. The cards in the carousel. A carousel must have at - least 2 cards and at most 10. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard) - }, - ), - "RbmStandaloneCard": _reflection.GeneratedProtocolMessageType( - "RbmStandaloneCard", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_RBMSTANDALONECARD, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Standalone Rich Business Messaging (RBM) rich card. Rich cards allow - you to respond to users with more vivid content, e.g. with media and - suggestions. You can group multiple rich cards into one using [RbmCar - ouselCard][google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselC - ard] but carousel cards will give you less control over the card - layout. - - Attributes: - card_orientation: - Required. Orientation of the card. - thumbnail_image_alignment: - Required if orientation is horizontal. Image preview alignment - for standalone cards with horizontal layout. - card_content: - Required. Card content. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard) - }, - ), - "RbmCardContent": _reflection.GeneratedProtocolMessageType( - "RbmCardContent", - (_message.Message,), - { - "RbmMedia": _reflection.GeneratedProtocolMessageType( - "RbmMedia", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_RBMCARDCONTENT_RBMMEDIA, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Rich Business Messaging (RBM) Media displayed in Cards The following - media-types are currently supported: Image Types - image/jpeg - - image/jpg’ - image/gif - image/png Video Types - video/h263 - - video/m4v - video/mp4 - video/mpeg - video/mpeg4 - video/webm - - Attributes: - file_uri: - Required. Publicly reachable URI of the file. The RBM platform - determines the MIME type of the file from the content-type - field in the HTTP headers when the platform fetches the file. - The content-type field must be present and accurate in the - HTTP response from the URL. - thumbnail_uri: - Optional. Publicly reachable URI of the thumbnail.If you don’t - provide a thumbnail URI, the RBM platform displays a blank - placeholder thumbnail until the user’s device downloads the - file. Depending on the user’s setting, the file may not - download automatically and may require the user to tap a - download button. - height: - Required for cards with vertical orientation. The height of - the media within a rich card with a vertical layout. For a - standalone card with horizontal layout, height is not - customizable, and this field is ignored. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_RBMCARDCONTENT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Rich Business Messaging (RBM) Card content - - Attributes: - title: - Optional. Title of the card (at most 200 bytes). At least one - of the title, description or media must be set. - description: - Optional. Description of the card (at most 2000 bytes). At - least one of the title, description or media must be set. - media: - Optional. However at least one of the title, description or - media must be set. Media (image, GIF or a video) to include in - the card. - suggestions: - Optional. List of suggestions to include in the card. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent) - }, - ), - "RbmSuggestion": _reflection.GeneratedProtocolMessageType( - "RbmSuggestion", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_RBMSUGGESTION, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Rich Business Messaging (RBM) suggestion. Suggestions allow user to - easily select/click a predefined response or perform an action (like - opening a web uri). - - Attributes: - suggestion: - Predefined suggested response or action for user to choose - reply: - Predefined replies for user to select instead of typing - action: - Predefined client side actions that user can choose - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion) - }, - ), - "RbmSuggestedReply": _reflection.GeneratedProtocolMessageType( - "RbmSuggestedReply", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_RBMSUGGESTEDREPLY, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Rich Business Messaging (RBM) suggested reply that the user can click - instead of typing in their own response. - - Attributes: - text: - Suggested reply text. - postback_data: - Opaque payload that the Dialogflow receives in a user event - when the user taps the suggested reply. This data will be also - forwarded to webhook to allow performing custom business - logic. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply) - }, - ), - "RbmSuggestedAction": _reflection.GeneratedProtocolMessageType( - "RbmSuggestedAction", - (_message.Message,), - { - "RbmSuggestedActionDial": _reflection.GeneratedProtocolMessageType( - "RbmSuggestedActionDial", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONDIAL, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Opens the user’s default dialer app with the specified phone number - but does not dial automatically. - - Attributes: - phone_number: - Required. The phone number to fill in the default dialer app. - This field should be in `E.164 - `__ format. An example of - a correctly formatted phone number: +15556767888. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial) - }, - ), - "RbmSuggestedActionOpenUri": _reflection.GeneratedProtocolMessageType( - "RbmSuggestedActionOpenUri", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONOPENURI, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Opens the user’s default web browser app to the specified uri If the - user has an app installed that is registered as the default handler - for the URL, then this app will be opened instead, and its icon will - be used in the suggested action UI. - - Attributes: - uri: - Required. The uri to open on the user device - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri) - }, - ), - "RbmSuggestedActionShareLocation": _reflection.GeneratedProtocolMessageType( - "RbmSuggestedActionShareLocation", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_RBMSUGGESTEDACTION_RBMSUGGESTEDACTIONSHARELOCATION, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Opens the device’s location chooser so the user can pick a location to - send back to the agent.""", - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_RBMSUGGESTEDACTION, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Rich Business Messaging (RBM) suggested client-side action that the - user can choose from the card. - - Attributes: - text: - Text to display alongside the action. - postback_data: - Opaque payload that the Dialogflow receives in a user event - when the user taps the suggested action. This data will be - also forwarded to webhook to allow performing custom business - logic. - action: - Action that needs to be triggered. - dial: - Suggested client side action: Dial a phone number - open_url: - Suggested client side action: Open a URI on device - share_location: - Suggested client side action: Share user location - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction) - }, - ), - "MediaContent": _reflection.GeneratedProtocolMessageType( - "MediaContent", - (_message.Message,), - { - "ResponseMediaObject": _reflection.GeneratedProtocolMessageType( - "ResponseMediaObject", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_MEDIACONTENT_RESPONSEMEDIAOBJECT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Response media object for media content card. - - Attributes: - name: - Required. Name of media card. - description: - Optional. Description of media card. - image: - Image to show with the media card. - large_image: - Optional. Image to display above media content. - icon: - Optional. Icon to display above media content. - content_url: - Required. Url where the media is stored. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_MEDIACONTENT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The media content card for Actions on Google. - - Attributes: - media_type: - Optional. What type of media is the content (ie “audio”). - media_objects: - Required. List of media objects. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent) - }, - ), - "BrowseCarouselCard": _reflection.GeneratedProtocolMessageType( - "BrowseCarouselCard", - (_message.Message,), - { - "BrowseCarouselCardItem": _reflection.GeneratedProtocolMessageType( - "BrowseCarouselCardItem", - (_message.Message,), - { - "OpenUrlAction": _reflection.GeneratedProtocolMessageType( - "OpenUrlAction", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM_OPENURLACTION, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Actions on Google action to open a given url. - - Attributes: - url: - Required. URL - url_type_hint: - Optional. Specifies the type of viewer that is used when - opening the URL. Defaults to opening via web browser. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_BROWSECAROUSELCARD_BROWSECAROUSELCARDITEM, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Browsing carousel tile - - Attributes: - open_uri_action: - Required. Action to present to the user. - title: - Required. Title of the carousel item. Maximum of two lines of - text. - description: - Optional. Description of the carousel item. Maximum of four - lines of text. - image: - Optional. Hero image for the carousel item. - footer: - Optional. Text that appears at the bottom of the Browse - Carousel Card. Maximum of one line of text. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE_BROWSECAROUSELCARD, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Browse Carousel Card for Actions on Google. https://developers.google. - com/actions/assistant/responses#browsing_carousel - - Attributes: - items: - Required. List of items in the Browse Carousel Card. Minimum - of two items, maximum of ten. - image_display_options: - Optional. Settings for displaying the image. Applies to every - image in [items][google.cloud.dialogflow.v2beta1.Intent.Messag - e.BrowseCarouselCard.items]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard) - }, - ), - "TableCard": _reflection.GeneratedProtocolMessageType( - "TableCard", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TABLECARD, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Table card for Actions on Google. - - Attributes: - title: - Required. Title of the card. - subtitle: - Optional. Subtitle to the title. - image: - Optional. Image which should be displayed on the card. - column_properties: - Optional. Display properties for the columns in this table. - rows: - Optional. Rows in this table of data. - buttons: - Optional. List of buttons for the card. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.TableCard) - }, - ), - "ColumnProperties": _reflection.GeneratedProtocolMessageType( - "ColumnProperties", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_COLUMNPROPERTIES, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Column properties for - [TableCard][google.cloud.dialogflow.v2beta1.Intent.Message.TableCard]. - - Attributes: - header: - Required. Column heading. - horizontal_alignment: - Optional. Defines text alignment for all cells in this column. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties) - }, - ), - "TableCardRow": _reflection.GeneratedProtocolMessageType( - "TableCardRow", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TABLECARDROW, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Row of - [TableCard][google.cloud.dialogflow.v2beta1.Intent.Message.TableCard]. - - Attributes: - cells: - Optional. List of cells that make up this row. - divider_after: - Optional. Whether to add a visual divider after this row. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow) - }, - ), - "TableCardCell": _reflection.GeneratedProtocolMessageType( - "TableCardCell", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_MESSAGE_TABLECARDCELL, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Cell of [TableCardRow][google.cloud.dialogflow.v2beta1.Intent.Message. - TableCardRow]. - - Attributes: - text: - Required. Text in this cell. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell) - }, - ), - "DESCRIPTOR": _INTENT_MESSAGE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Corresponds to the ``Response`` field in the Dialogflow console. - - Attributes: - message: - Required. The rich response message. - text: - Returns a text response. - image: - Displays an image. - quick_replies: - Displays quick replies. - card: - Displays a card. - payload: - A custom platform-specific response. - simple_responses: - Returns a voice or text-only response for Actions on Google. - basic_card: - Displays a basic card for Actions on Google. - suggestions: - Displays suggestion chips for Actions on Google. - link_out_suggestion: - Displays a link out suggestion chip for Actions on Google. - list_select: - Displays a list card for Actions on Google. - carousel_select: - Displays a carousel card for Actions on Google. - telephony_play_audio: - Plays audio from a file in Telephony Gateway. - telephony_synthesize_speech: - Synthesizes speech in Telephony Gateway. - telephony_transfer_call: - Transfers the call in Telephony Gateway. - rbm_text: - Rich Business Messaging (RBM) text response. RBM allows - businesses to send enriched and branded versions of SMS. See - https://jibe.google.com/business-messaging. - rbm_standalone_rich_card: - Standalone Rich Business Messaging (RBM) rich card response. - rbm_carousel_rich_card: - Rich Business Messaging (RBM) carousel rich card response. - browse_carousel_card: - Browse carousel card for Actions on Google. - table_card: - Table card for Actions on Google. - media_content: - The media content card for Actions on Google. - platform: - Optional. The platform that this message is intended for. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.Message) - }, - ), - "FollowupIntentInfo": _reflection.GeneratedProtocolMessageType( - "FollowupIntentInfo", - (_message.Message,), - { - "DESCRIPTOR": _INTENT_FOLLOWUPINTENTINFO, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """Represents a single followup intent in the chain. - - Attributes: - followup_intent_name: - The unique identifier of the followup intent. Format: - ``projects//agent/intents/``. - parent_followup_intent_name: - The unique identifier of the followup intent’s parent. Format: - ``projects//agent/intents/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo) - }, - ), - "DESCRIPTOR": _INTENT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """An intent categorizes an end-user’s intention for one conversation - turn. For each agent, you define many intents, where your combined - intents can handle a complete conversation. When an end-user writes or - says something, referred to as an end-user expression or end-user - input, Dialogflow matches the end-user input to the best intent in - your agent. Matching an intent is also known as intent classification. - For more information, see the `intent guide - `__. - - Attributes: - name: - Optional. The unique identifier of this intent. Required for [ - Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents. - UpdateIntent] and [Intents.BatchUpdateIntents][google.cloud.di - alogflow.v2beta1.Intents.BatchUpdateIntents] methods. Format: - ``projects//agent/intents/``. - display_name: - Required. The name of this intent. - webhook_state: - Optional. Indicates whether webhooks are enabled for the - intent. - priority: - Optional. The priority of this intent. Higher numbers - represent higher priorities. - If the supplied value is - unspecified or 0, the service translates the value to - 500,000, which corresponds to the ``Normal`` priority in the - console. - If the supplied value is negative, the intent is - ignored in runtime detect intent requests. - is_fallback: - Optional. Indicates whether this is a fallback intent. - ml_enabled: - Optional. Indicates whether Machine Learning is enabled for - the intent. Note: If ``ml_enabled`` setting is set to false, - then this intent is not taken into account during inference in - ``ML ONLY`` match mode. Also, auto-markup in the UI is turned - off. DEPRECATED! Please use ``ml_disabled`` field instead. - NOTE: If both ``ml_enabled`` and ``ml_disabled`` are either - not set or false, then the default value is determined as - follows: - Before April 15th, 2018 the default is: ml_enabled - = false / ml_disabled = true. - After April 15th, 2018 the - default is: ml_enabled = true / ml_disabled = false. - ml_disabled: - Optional. Indicates whether Machine Learning is disabled for - the intent. Note: If ``ml_disabled`` setting is set to true, - then this intent is not taken into account during inference in - ``ML ONLY`` match mode. Also, auto-markup in the UI is turned - off. - end_interaction: - Optional. Indicates that this intent ends an interaction. Some - integrations (e.g., Actions on Google or Dialogflow phone - gateway) use this information to close interaction with an end - user. Default is false. - input_context_names: - Optional. The list of context names required for this intent - to be triggered. Format: ``projects//agent/sessions/-/contexts/``. - events: - Optional. The collection of event names that trigger the - intent. If the collection of input contexts is not empty, all - of the contexts must be present in the active user session for - an event to trigger this intent. Event names are limited to - 150 characters. - training_phrases: - Optional. The collection of examples that the agent is trained - on. - action: - Optional. The name of the action associated with the intent. - Note: The action name must not contain whitespaces. - output_contexts: - Optional. The collection of contexts that are activated when - the intent is matched. Context messages in this collection - should not set the parameters field. Setting the - ``lifespan_count`` to 0 will reset the context when the intent - is matched. Format: ``projects//agent/sessions/-/contexts/``. - reset_contexts: - Optional. Indicates whether to delete all contexts in the - current session when this intent is matched. - parameters: - Optional. The collection of parameters associated with the - intent. - messages: - Optional. The collection of rich messages corresponding to the - ``Response`` field in the Dialogflow console. - default_response_platforms: - Optional. The list of platforms for which the first responses - will be copied from the messages in PLATFORM_UNSPECIFIED - (i.e. default platform). - root_followup_intent_name: - Output only. The unique identifier of the root intent in the - chain of followup intents. It identifies the correct followup - intents chain for this intent. Format: ``projects//agent/intents/``. - parent_followup_intent_name: - Optional. The unique identifier of the parent intent in the - chain of followup intents. You can set this field when - creating an intent, for example with [CreateIntent][google.clo - ud.dialogflow.v2beta1.Intents.CreateIntent] or [BatchUpdateInt - ents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateInten - ts], in order to make this intent a followup intent. It - identifies the parent followup intent. Format: - ``projects//agent/intents/``. - followup_intent_info: - Output only. Information about all followup intents that have - this intent as a direct or indirect parent. We populate this - field only in the output. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Intent) - }, -) -_sym_db.RegisterMessage(Intent) -_sym_db.RegisterMessage(Intent.TrainingPhrase) -_sym_db.RegisterMessage(Intent.TrainingPhrase.Part) -_sym_db.RegisterMessage(Intent.Parameter) -_sym_db.RegisterMessage(Intent.Message) -_sym_db.RegisterMessage(Intent.Message.Text) -_sym_db.RegisterMessage(Intent.Message.Image) -_sym_db.RegisterMessage(Intent.Message.QuickReplies) -_sym_db.RegisterMessage(Intent.Message.Card) -_sym_db.RegisterMessage(Intent.Message.Card.Button) -_sym_db.RegisterMessage(Intent.Message.SimpleResponse) -_sym_db.RegisterMessage(Intent.Message.SimpleResponses) -_sym_db.RegisterMessage(Intent.Message.BasicCard) -_sym_db.RegisterMessage(Intent.Message.BasicCard.Button) -_sym_db.RegisterMessage(Intent.Message.BasicCard.Button.OpenUriAction) -_sym_db.RegisterMessage(Intent.Message.Suggestion) -_sym_db.RegisterMessage(Intent.Message.Suggestions) -_sym_db.RegisterMessage(Intent.Message.LinkOutSuggestion) -_sym_db.RegisterMessage(Intent.Message.ListSelect) -_sym_db.RegisterMessage(Intent.Message.ListSelect.Item) -_sym_db.RegisterMessage(Intent.Message.CarouselSelect) -_sym_db.RegisterMessage(Intent.Message.CarouselSelect.Item) -_sym_db.RegisterMessage(Intent.Message.SelectItemInfo) -_sym_db.RegisterMessage(Intent.Message.TelephonyPlayAudio) -_sym_db.RegisterMessage(Intent.Message.TelephonySynthesizeSpeech) -_sym_db.RegisterMessage(Intent.Message.TelephonyTransferCall) -_sym_db.RegisterMessage(Intent.Message.RbmText) -_sym_db.RegisterMessage(Intent.Message.RbmCarouselCard) -_sym_db.RegisterMessage(Intent.Message.RbmStandaloneCard) -_sym_db.RegisterMessage(Intent.Message.RbmCardContent) -_sym_db.RegisterMessage(Intent.Message.RbmCardContent.RbmMedia) -_sym_db.RegisterMessage(Intent.Message.RbmSuggestion) -_sym_db.RegisterMessage(Intent.Message.RbmSuggestedReply) -_sym_db.RegisterMessage(Intent.Message.RbmSuggestedAction) -_sym_db.RegisterMessage(Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial) -_sym_db.RegisterMessage(Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri) -_sym_db.RegisterMessage( - Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation -) -_sym_db.RegisterMessage(Intent.Message.MediaContent) -_sym_db.RegisterMessage(Intent.Message.MediaContent.ResponseMediaObject) -_sym_db.RegisterMessage(Intent.Message.BrowseCarouselCard) -_sym_db.RegisterMessage(Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem) -_sym_db.RegisterMessage( - Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction -) -_sym_db.RegisterMessage(Intent.Message.TableCard) -_sym_db.RegisterMessage(Intent.Message.ColumnProperties) -_sym_db.RegisterMessage(Intent.Message.TableCardRow) -_sym_db.RegisterMessage(Intent.Message.TableCardCell) -_sym_db.RegisterMessage(Intent.FollowupIntentInfo) - -ListIntentsRequest = _reflection.GeneratedProtocolMessageType( - "ListIntentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTINTENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The request message for [Intents.ListIntents][google.cloud.dialogflow. - v2beta1.Intents.ListIntents]. - - Attributes: - parent: - Required. The agent to list all intents from. Format: - ``projects//agent``. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - intent_view: - Optional. The resource view to apply to the returned intent. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListIntentsRequest) - }, -) -_sym_db.RegisterMessage(ListIntentsRequest) - -ListIntentsResponse = _reflection.GeneratedProtocolMessageType( - "ListIntentsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTINTENTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The response message for [Intents.ListIntents][google.cloud.dialogflow - .v2beta1.Intents.ListIntents]. - - Attributes: - intents: - The list of agent intents. There will be a maximum number of - items returned based on the page_size field in the request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListIntentsResponse) - }, -) -_sym_db.RegisterMessage(ListIntentsResponse) - -GetIntentRequest = _reflection.GeneratedProtocolMessageType( - "GetIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The request message for [Intents.GetIntent][google.cloud.dialogflow.v2 - beta1.Intents.GetIntent]. - - Attributes: - name: - Required. The name of the intent. Format: ``projects//agent/intents/``. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - intent_view: - Optional. The resource view to apply to the returned intent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.GetIntentRequest) - }, -) -_sym_db.RegisterMessage(GetIntentRequest) - -CreateIntentRequest = _reflection.GeneratedProtocolMessageType( - "CreateIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The request message for [Intents.CreateIntent][google.cloud.dialogflow - .v2beta1.Intents.CreateIntent]. - - Attributes: - parent: - Required. The agent to create a intent for. Format: - ``projects//agent``. - intent: - Required. The intent to create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - intent_view: - Optional. The resource view to apply to the returned intent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.CreateIntentRequest) - }, -) -_sym_db.RegisterMessage(CreateIntentRequest) - -UpdateIntentRequest = _reflection.GeneratedProtocolMessageType( - "UpdateIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The request message for [Intents.UpdateIntent][google.cloud.dialogflow - .v2beta1.Intents.UpdateIntent]. - - Attributes: - intent: - Required. The intent to update. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - update_mask: - Optional. The mask to control which fields get updated. - intent_view: - Optional. The resource view to apply to the returned intent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.UpdateIntentRequest) - }, -) -_sym_db.RegisterMessage(UpdateIntentRequest) - -DeleteIntentRequest = _reflection.GeneratedProtocolMessageType( - "DeleteIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The request message for [Intents.DeleteIntent][google.cloud.dialogflow - .v2beta1.Intents.DeleteIntent]. - - Attributes: - name: - Required. The name of the intent to delete. If this intent has - direct or indirect followup intents, we also delete them. - Format: ``projects//agent/intents/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.DeleteIntentRequest) - }, -) -_sym_db.RegisterMessage(DeleteIntentRequest) - -BatchUpdateIntentsRequest = _reflection.GeneratedProtocolMessageType( - "BatchUpdateIntentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEINTENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The request message for [Intents.BatchUpdateIntents][google.cloud.dial - ogflow.v2beta1.Intents.BatchUpdateIntents]. - - Attributes: - parent: - Required. The name of the agent to update or create intents - in. Format: ``projects//agent``. - intent_batch: - Required. The source of the intent batch. For each intent in - the batch: - If ``name`` is specified, we update an existing - intent. - If ``name`` is not specified, we create a new - intent. - intent_batch_uri: - The URI to a Google Cloud Storage file containing intents to - update or create. The file format can either be a serialized - proto (of IntentBatch type) or JSON object. Note: The URI must - start with “gs://”. - intent_batch_inline: - The collection of intents to update or create. - language_code: - Optional. The language used to access language-specific data. - If not specified, the agent’s default language is used. For - more information, see `Multilingual intent and entity data - `__. - update_mask: - Optional. The mask to control which fields get updated. - intent_view: - Optional. The resource view to apply to the returned intent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest) - }, -) -_sym_db.RegisterMessage(BatchUpdateIntentsRequest) - -BatchUpdateIntentsResponse = _reflection.GeneratedProtocolMessageType( - "BatchUpdateIntentsResponse", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEINTENTSRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The response message for [Intents.BatchUpdateIntents][google.cloud.dia - logflow.v2beta1.Intents.BatchUpdateIntents]. - - Attributes: - intents: - The collection of updated or created intents. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse) - }, -) -_sym_db.RegisterMessage(BatchUpdateIntentsResponse) - -BatchDeleteIntentsRequest = _reflection.GeneratedProtocolMessageType( - "BatchDeleteIntentsRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHDELETEINTENTSREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """The request message for [Intents.BatchDeleteIntents][google.cloud.dial - ogflow.v2beta1.Intents.BatchDeleteIntents]. - - Attributes: - parent: - Required. The name of the agent to delete all entities types - for. Format: ``projects//agent``. - intents: - Required. The collection of intents to delete. Only intent - ``name`` must be filled in. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest) - }, -) -_sym_db.RegisterMessage(BatchDeleteIntentsRequest) - -IntentBatch = _reflection.GeneratedProtocolMessageType( - "IntentBatch", - (_message.Message,), - { - "DESCRIPTOR": _INTENTBATCH, - "__module__": "google.cloud.dialogflow_v2beta1.proto.intent_pb2", - "__doc__": """This message is a wrapper around a collection of intents. - - Attributes: - intents: - A collection of intents. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.IntentBatch) - }, -) -_sym_db.RegisterMessage(IntentBatch) - - -DESCRIPTOR._options = None -_INTENT_TRAININGPHRASE_TYPE.values_by_name["TEMPLATE"]._options = None -_INTENT_TRAININGPHRASE.fields_by_name["type"]._options = None -_INTENT_TRAININGPHRASE.fields_by_name["parts"]._options = None -_INTENT_TRAININGPHRASE.fields_by_name["times_added_count"]._options = None -_INTENT_MESSAGE_LISTSELECT.fields_by_name["subtitle"]._options = None -_INTENT_MESSAGE.fields_by_name["platform"]._options = None -_INTENT.fields_by_name["name"]._options = None -_INTENT.fields_by_name["display_name"]._options = None -_INTENT.fields_by_name["webhook_state"]._options = None -_INTENT.fields_by_name["priority"]._options = None -_INTENT.fields_by_name["is_fallback"]._options = None -_INTENT.fields_by_name["ml_enabled"]._options = None -_INTENT.fields_by_name["ml_disabled"]._options = None -_INTENT.fields_by_name["end_interaction"]._options = None -_INTENT.fields_by_name["input_context_names"]._options = None -_INTENT.fields_by_name["events"]._options = None -_INTENT.fields_by_name["training_phrases"]._options = None -_INTENT.fields_by_name["action"]._options = None -_INTENT.fields_by_name["output_contexts"]._options = None -_INTENT.fields_by_name["reset_contexts"]._options = None -_INTENT.fields_by_name["parameters"]._options = None -_INTENT.fields_by_name["default_response_platforms"]._options = None -_INTENT.fields_by_name["root_followup_intent_name"]._options = None -_INTENT.fields_by_name["parent_followup_intent_name"]._options = None -_INTENT.fields_by_name["followup_intent_info"]._options = None -_INTENT._options = None -_LISTINTENTSREQUEST.fields_by_name["parent"]._options = None -_LISTINTENTSREQUEST.fields_by_name["language_code"]._options = None -_GETINTENTREQUEST.fields_by_name["name"]._options = None -_GETINTENTREQUEST.fields_by_name["language_code"]._options = None -_CREATEINTENTREQUEST.fields_by_name["parent"]._options = None -_CREATEINTENTREQUEST.fields_by_name["intent"]._options = None -_CREATEINTENTREQUEST.fields_by_name["language_code"]._options = None -_UPDATEINTENTREQUEST.fields_by_name["intent"]._options = None -_UPDATEINTENTREQUEST.fields_by_name["language_code"]._options = None -_DELETEINTENTREQUEST.fields_by_name["name"]._options = None -_BATCHUPDATEINTENTSREQUEST.fields_by_name["parent"]._options = None -_BATCHUPDATEINTENTSREQUEST.fields_by_name["language_code"]._options = None -_BATCHDELETEINTENTSREQUEST.fields_by_name["parent"]._options = None -_BATCHDELETEINTENTSREQUEST.fields_by_name["intents"]._options = None - -_INTENTS = _descriptor.ServiceDescriptor( - name="Intents", - full_name="google.cloud.dialogflow.v2beta1.Intents", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=12354, - serialized_end=14501, - methods=[ - _descriptor.MethodDescriptor( - name="ListIntents", - full_name="google.cloud.dialogflow.v2beta1.Intents.ListIntents", - index=0, - containing_service=None, - input_type=_LISTINTENTSREQUEST, - output_type=_LISTINTENTSRESPONSE, - serialized_options=b"\202\323\344\223\002f\022*/v2beta1/{parent=projects/*/agent}/intentsZ8\0226/v2beta1/{parent=projects/*/locations/*/agent}/intents\332A\006parent\332A\024parent,language_code", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetIntent", - full_name="google.cloud.dialogflow.v2beta1.Intents.GetIntent", - index=1, - containing_service=None, - input_type=_GETINTENTREQUEST, - output_type=_INTENT, - serialized_options=b"\202\323\344\223\002f\022*/v2beta1/{name=projects/*/agent/intents/*}Z8\0226/v2beta1/{name=projects/*/locations/*/agent/intents/*}\332A\004name\332A\022name,language_code", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateIntent", - full_name="google.cloud.dialogflow.v2beta1.Intents.CreateIntent", - index=2, - containing_service=None, - input_type=_CREATEINTENTREQUEST, - output_type=_INTENT, - serialized_options=b'\202\323\344\223\002v"*/v2beta1/{parent=projects/*/agent}/intents:\006intentZ@"6/v2beta1/{parent=projects/*/locations/*/agent}/intents:\006intent\332A\rparent,intent\332A\033parent,intent,language_code', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateIntent", - full_name="google.cloud.dialogflow.v2beta1.Intents.UpdateIntent", - index=3, - containing_service=None, - input_type=_UPDATEINTENTREQUEST, - output_type=_INTENT, - serialized_options=b"\202\323\344\223\002\204\00121/v2beta1/{intent.name=projects/*/agent/intents/*}:\006intentZG2=/v2beta1/{intent.name=projects/*/locations/*/agent/intents/*}:\006intent\332A\022intent,update_mask\332A\006intent\332A\024intent,language_code\332A intent,language_code,update_mask", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteIntent", - full_name="google.cloud.dialogflow.v2beta1.Intents.DeleteIntent", - index=4, - containing_service=None, - input_type=_DELETEINTENTREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002f**/v2beta1/{name=projects/*/agent/intents/*}Z8*6/v2beta1/{name=projects/*/locations/*/agent/intents/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchUpdateIntents", - full_name="google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents", - index=5, - containing_service=None, - input_type=_BATCHUPDATEINTENTSREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002\204\001"6/v2beta1/{parent=projects/*/agent}/intents:batchUpdate:\001*ZG"B/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchUpdate:\001*\312AT\n:google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchDeleteIntents", - full_name="google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents", - index=6, - containing_service=None, - input_type=_BATCHDELETEINTENTSREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002\204\001"6/v2beta1/{parent=projects/*/agent}/intents:batchDelete:\001*ZG"B/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchDelete:\001*\332A\016parent,intents\312A/\n\025google.protobuf.Empty\022\026google.protobuf.Struct', - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_INTENTS) - -DESCRIPTOR.services_by_name["Intents"] = _INTENTS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/intent_pb2_grpc.py b/dialogflow_v2beta1/proto/intent_pb2_grpc.py deleted file mode 100644 index d60206cec..000000000 --- a/dialogflow_v2beta1/proto/intent_pb2_grpc.py +++ /dev/null @@ -1,356 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2beta1.proto import ( - intent_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class IntentsStub(object): - """Service for managing [Intents][google.cloud.dialogflow.v2beta1.Intent]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListIntents = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Intents/ListIntents", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.ListIntentsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.ListIntentsResponse.FromString, - ) - self.GetIntent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Intents/GetIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.GetIntentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.Intent.FromString, - ) - self.CreateIntent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Intents/CreateIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.CreateIntentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.Intent.FromString, - ) - self.UpdateIntent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Intents/UpdateIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.UpdateIntentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.Intent.FromString, - ) - self.DeleteIntent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Intents/DeleteIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.DeleteIntentRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.BatchUpdateIntents = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Intents/BatchUpdateIntents", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.BatchUpdateIntentsRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.BatchDeleteIntents = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Intents/BatchDeleteIntents", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.BatchDeleteIntentsRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - - -class IntentsServicer(object): - """Service for managing [Intents][google.cloud.dialogflow.v2beta1.Intent]. - """ - - def ListIntents(self, request, context): - """Returns the list of all intents in the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetIntent(self, request, context): - """Retrieves the specified intent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateIntent(self, request, context): - """Creates an intent in the specified agent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateIntent(self, request, context): - """Updates the specified intent. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteIntent(self, request, context): - """Deletes the specified intent and its direct or indirect followup intents. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchUpdateIntents(self, request, context): - """Updates/Creates multiple intents in the specified agent. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchDeleteIntents(self, request, context): - """Deletes intents in the specified agent. - - Operation - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_IntentsServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListIntents": grpc.unary_unary_rpc_method_handler( - servicer.ListIntents, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.ListIntentsRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.ListIntentsResponse.SerializeToString, - ), - "GetIntent": grpc.unary_unary_rpc_method_handler( - servicer.GetIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.GetIntentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.Intent.SerializeToString, - ), - "CreateIntent": grpc.unary_unary_rpc_method_handler( - servicer.CreateIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.CreateIntentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.Intent.SerializeToString, - ), - "UpdateIntent": grpc.unary_unary_rpc_method_handler( - servicer.UpdateIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.UpdateIntentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.Intent.SerializeToString, - ), - "DeleteIntent": grpc.unary_unary_rpc_method_handler( - servicer.DeleteIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.DeleteIntentRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "BatchUpdateIntents": grpc.unary_unary_rpc_method_handler( - servicer.BatchUpdateIntents, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.BatchUpdateIntentsRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "BatchDeleteIntents": grpc.unary_unary_rpc_method_handler( - servicer.BatchDeleteIntents, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.BatchDeleteIntentsRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2beta1.Intents", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Intents(object): - """Service for managing [Intents][google.cloud.dialogflow.v2beta1.Intent]. - """ - - @staticmethod - def ListIntents( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Intents/ListIntents", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.ListIntentsRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.ListIntentsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetIntent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Intents/GetIntent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.GetIntentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.Intent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateIntent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Intents/CreateIntent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.CreateIntentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.Intent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateIntent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Intents/UpdateIntent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.UpdateIntentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.Intent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteIntent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Intents/DeleteIntent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.DeleteIntentRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchUpdateIntents( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Intents/BatchUpdateIntents", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.BatchUpdateIntentsRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchDeleteIntents( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Intents/BatchDeleteIntents", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.BatchDeleteIntentsRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2beta1/proto/knowledge_base_pb2.py b/dialogflow_v2beta1/proto/knowledge_base_pb2.py deleted file mode 100644 index e9785057e..000000000 --- a/dialogflow_v2beta1/proto/knowledge_base_pb2.py +++ /dev/null @@ -1,756 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/knowledge_base.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/knowledge_base.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\022KnowledgeBaseProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n:google/cloud/dialogflow_v2beta1/proto/knowledge_base.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\xb1\x01\n\rKnowledgeBase\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x15\n\rlanguage_code\x18\x04 \x01(\t:`\xea\x41]\n\'dialogflow.googleapis.com/KnowledgeBase\x12\x32projects/{project}/knowledgeBases/{knowledge_base}"\x8d\x01\n\x19ListKnowledgeBasesRequest\x12?\n\x06parent\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\x12\'dialogflow.googleapis.com/KnowledgeBase\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01"~\n\x1aListKnowledgeBasesResponse\x12G\n\x0fknowledge_bases\x18\x01 \x03(\x0b\x32..google.cloud.dialogflow.v2beta1.KnowledgeBase\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"X\n\x17GetKnowledgeBaseRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'dialogflow.googleapis.com/KnowledgeBase"\xaa\x01\n\x1a\x43reateKnowledgeBaseRequest\x12?\n\x06parent\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\x12\'dialogflow.googleapis.com/KnowledgeBase\x12K\n\x0eknowledge_base\x18\x02 \x01(\x0b\x32..google.cloud.dialogflow.v2beta1.KnowledgeBaseB\x03\xe0\x41\x02"j\n\x1a\x44\x65leteKnowledgeBaseRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'dialogflow.googleapis.com/KnowledgeBase\x12\r\n\x05\x66orce\x18\x02 \x01(\x08"\x9f\x01\n\x1aUpdateKnowledgeBaseRequest\x12K\n\x0eknowledge_base\x18\x01 \x01(\x0b\x32..google.cloud.dialogflow.v2beta1.KnowledgeBaseB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\x32\xe1\x0b\n\x0eKnowledgeBases\x12\x80\x02\n\x12ListKnowledgeBases\x12:.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest\x1a;.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse"q\x82\xd3\xe4\x93\x02\x62\x12+/v2beta1/{parent=projects/*}/knowledgeBasesZ3\x12\x31/v2beta1/{parent=projects/*/agent}/knowledgeBases\xda\x41\x06parent\x12\xed\x01\n\x10GetKnowledgeBase\x12\x38.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest\x1a..google.cloud.dialogflow.v2beta1.KnowledgeBase"o\x82\xd3\xe4\x93\x02\x62\x12+/v2beta1/{name=projects/*/knowledgeBases/*}Z3\x12\x31/v2beta1/{name=projects/*/agent/knowledgeBases/*}\xda\x41\x04name\x12\xa6\x02\n\x13\x43reateKnowledgeBase\x12;.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest\x1a..google.cloud.dialogflow.v2beta1.KnowledgeBase"\xa1\x01\x82\xd3\xe4\x93\x02\x82\x01"+/v2beta1/{parent=projects/*}/knowledgeBases:\x0eknowledge_baseZC"1/v2beta1/{parent=projects/*/agent}/knowledgeBases:\x0eknowledge_base\xda\x41\x15parent,knowledge_base\x12\xdb\x01\n\x13\x44\x65leteKnowledgeBase\x12;.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest\x1a\x16.google.protobuf.Empty"o\x82\xd3\xe4\x93\x02\x62*+/v2beta1/{name=projects/*/knowledgeBases/*}Z3*1/v2beta1/{name=projects/*/agent/knowledgeBases/*}\xda\x41\x04name\x12\xda\x02\n\x13UpdateKnowledgeBase\x12;.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest\x1a..google.cloud.dialogflow.v2beta1.KnowledgeBase"\xd5\x01\x82\xd3\xe4\x93\x02\xa0\x01\x32:/v2beta1/{knowledge_base.name=projects/*/knowledgeBases/*}:\x0eknowledge_baseZR2@/v2beta1/{knowledge_base.name=projects/*/agent/knowledgeBases/*}:\x0eknowledge_base\xda\x41\x1aknowledge_base,update_mask\xda\x41\x0eknowledge_base\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\xb0\x01\n#com.google.cloud.dialogflow.v2beta1B\x12KnowledgeBaseProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - ], -) - - -_KNOWLEDGEBASE = _descriptor.Descriptor( - name="KnowledgeBase", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeBase", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeBase.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeBase.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeBase.language_code", - index=2, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"\352A]\n'dialogflow.googleapis.com/KnowledgeBase\0222projects/{project}/knowledgeBases/{knowledge_base}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=274, - serialized_end=451, -) - - -_LISTKNOWLEDGEBASESREQUEST = _descriptor.Descriptor( - name="ListKnowledgeBasesRequest", - full_name="google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A)\022'dialogflow.googleapis.com/KnowledgeBase", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=454, - serialized_end=595, -) - - -_LISTKNOWLEDGEBASESRESPONSE = _descriptor.Descriptor( - name="ListKnowledgeBasesResponse", - full_name="google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="knowledge_bases", - full_name="google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse.knowledge_bases", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=597, - serialized_end=723, -) - - -_GETKNOWLEDGEBASEREQUEST = _descriptor.Descriptor( - name="GetKnowledgeBaseRequest", - full_name="google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A)\n'dialogflow.googleapis.com/KnowledgeBase", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=725, - serialized_end=813, -) - - -_CREATEKNOWLEDGEBASEREQUEST = _descriptor.Descriptor( - name="CreateKnowledgeBaseRequest", - full_name="google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A)\022'dialogflow.googleapis.com/KnowledgeBase", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="knowledge_base", - full_name="google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest.knowledge_base", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=816, - serialized_end=986, -) - - -_DELETEKNOWLEDGEBASEREQUEST = _descriptor.Descriptor( - name="DeleteKnowledgeBaseRequest", - full_name="google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A)\n'dialogflow.googleapis.com/KnowledgeBase", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="force", - full_name="google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest.force", - index=1, - number=2, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=988, - serialized_end=1094, -) - - -_UPDATEKNOWLEDGEBASEREQUEST = _descriptor.Descriptor( - name="UpdateKnowledgeBaseRequest", - full_name="google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="knowledge_base", - full_name="google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest.knowledge_base", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1097, - serialized_end=1256, -) - -_LISTKNOWLEDGEBASESRESPONSE.fields_by_name[ - "knowledge_bases" -].message_type = _KNOWLEDGEBASE -_CREATEKNOWLEDGEBASEREQUEST.fields_by_name[ - "knowledge_base" -].message_type = _KNOWLEDGEBASE -_UPDATEKNOWLEDGEBASEREQUEST.fields_by_name[ - "knowledge_base" -].message_type = _KNOWLEDGEBASE -_UPDATEKNOWLEDGEBASEREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -DESCRIPTOR.message_types_by_name["KnowledgeBase"] = _KNOWLEDGEBASE -DESCRIPTOR.message_types_by_name[ - "ListKnowledgeBasesRequest" -] = _LISTKNOWLEDGEBASESREQUEST -DESCRIPTOR.message_types_by_name[ - "ListKnowledgeBasesResponse" -] = _LISTKNOWLEDGEBASESRESPONSE -DESCRIPTOR.message_types_by_name["GetKnowledgeBaseRequest"] = _GETKNOWLEDGEBASEREQUEST -DESCRIPTOR.message_types_by_name[ - "CreateKnowledgeBaseRequest" -] = _CREATEKNOWLEDGEBASEREQUEST -DESCRIPTOR.message_types_by_name[ - "DeleteKnowledgeBaseRequest" -] = _DELETEKNOWLEDGEBASEREQUEST -DESCRIPTOR.message_types_by_name[ - "UpdateKnowledgeBaseRequest" -] = _UPDATEKNOWLEDGEBASEREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -KnowledgeBase = _reflection.GeneratedProtocolMessageType( - "KnowledgeBase", - (_message.Message,), - { - "DESCRIPTOR": _KNOWLEDGEBASE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.knowledge_base_pb2", - "__doc__": """A knowledge base represents a collection of knowledge documents that - you provide to Dialogflow. Your knowledge documents contain - information that may be useful during conversations with end-users. - Some Dialogflow features use knowledge bases when looking for a - response to an end-user input. For more information, see the - `knowledge base guide - `__. - Note: The ``projects.agent.knowledgeBases`` resource is deprecated; - only use ``projects.knowledgeBases``. - - Attributes: - name: - The knowledge base resource name. The name must be empty when - creating a knowledge base. Format: ``projects//knowledgeBases/``. - display_name: - Required. The display name of the knowledge base. The name - must be 1024 bytes or less; otherwise, the creation request - fails. - language_code: - Language which represents the KnowledgeBase. When the - KnowledgeBase is created/updated, this is populated for all - non en-us languages. If not populated, the default language - en-us applies. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.KnowledgeBase) - }, -) -_sym_db.RegisterMessage(KnowledgeBase) - -ListKnowledgeBasesRequest = _reflection.GeneratedProtocolMessageType( - "ListKnowledgeBasesRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTKNOWLEDGEBASESREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.knowledge_base_pb2", - "__doc__": """Request message for [KnowledgeBases.ListKnowledgeBases][google.cloud.d - ialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. - - Attributes: - parent: - Required. The project to list of knowledge bases for. Format: - ``projects/``. - page_size: - Optional. The maximum number of items to return in a single - page. By default 10 and at most 100. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest) - }, -) -_sym_db.RegisterMessage(ListKnowledgeBasesRequest) - -ListKnowledgeBasesResponse = _reflection.GeneratedProtocolMessageType( - "ListKnowledgeBasesResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTKNOWLEDGEBASESRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.knowledge_base_pb2", - "__doc__": """Response message for [KnowledgeBases.ListKnowledgeBases][google.cloud. - dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. - - Attributes: - knowledge_bases: - The list of knowledge bases. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse) - }, -) -_sym_db.RegisterMessage(ListKnowledgeBasesResponse) - -GetKnowledgeBaseRequest = _reflection.GeneratedProtocolMessageType( - "GetKnowledgeBaseRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETKNOWLEDGEBASEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.knowledge_base_pb2", - "__doc__": """Request message for [KnowledgeBases.GetKnowledgeBase][google.cloud.dia - logflow.v2beta1.KnowledgeBases.GetKnowledgeBase]. - - Attributes: - name: - Required. The name of the knowledge base to retrieve. Format - ``projects//knowledgeBases/``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest) - }, -) -_sym_db.RegisterMessage(GetKnowledgeBaseRequest) - -CreateKnowledgeBaseRequest = _reflection.GeneratedProtocolMessageType( - "CreateKnowledgeBaseRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEKNOWLEDGEBASEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.knowledge_base_pb2", - "__doc__": """Request message for [KnowledgeBases.CreateKnowledgeBase][google.cloud. - dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase]. - - Attributes: - parent: - Required. The project to create a knowledge base for. Format: - ``projects/``. - knowledge_base: - Required. The knowledge base to create. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest) - }, -) -_sym_db.RegisterMessage(CreateKnowledgeBaseRequest) - -DeleteKnowledgeBaseRequest = _reflection.GeneratedProtocolMessageType( - "DeleteKnowledgeBaseRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEKNOWLEDGEBASEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.knowledge_base_pb2", - "__doc__": """Request message for [KnowledgeBases.DeleteKnowledgeBase][google.cloud. - dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase]. - - Attributes: - name: - Required. The name of the knowledge base to delete. Format: - ``projects//knowledgeBases/``. - force: - Optional. Force deletes the knowledge base. When set to true, - any documents in the knowledge base are also deleted. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest) - }, -) -_sym_db.RegisterMessage(DeleteKnowledgeBaseRequest) - -UpdateKnowledgeBaseRequest = _reflection.GeneratedProtocolMessageType( - "UpdateKnowledgeBaseRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEKNOWLEDGEBASEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.knowledge_base_pb2", - "__doc__": """Request message for [KnowledgeBases.UpdateKnowledgeBase][google.cloud. - dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase]. - - Attributes: - knowledge_base: - Required. The knowledge base to update. - update_mask: - Optional. Not specified means ``update all``. Currently, only - ``display_name`` can be updated, an InvalidArgument will be - returned for attempting to update other fields. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest) - }, -) -_sym_db.RegisterMessage(UpdateKnowledgeBaseRequest) - - -DESCRIPTOR._options = None -_KNOWLEDGEBASE.fields_by_name["display_name"]._options = None -_KNOWLEDGEBASE._options = None -_LISTKNOWLEDGEBASESREQUEST.fields_by_name["parent"]._options = None -_LISTKNOWLEDGEBASESREQUEST.fields_by_name["page_size"]._options = None -_LISTKNOWLEDGEBASESREQUEST.fields_by_name["page_token"]._options = None -_GETKNOWLEDGEBASEREQUEST.fields_by_name["name"]._options = None -_CREATEKNOWLEDGEBASEREQUEST.fields_by_name["parent"]._options = None -_CREATEKNOWLEDGEBASEREQUEST.fields_by_name["knowledge_base"]._options = None -_DELETEKNOWLEDGEBASEREQUEST.fields_by_name["name"]._options = None -_UPDATEKNOWLEDGEBASEREQUEST.fields_by_name["knowledge_base"]._options = None -_UPDATEKNOWLEDGEBASEREQUEST.fields_by_name["update_mask"]._options = None - -_KNOWLEDGEBASES = _descriptor.ServiceDescriptor( - name="KnowledgeBases", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeBases", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=1259, - serialized_end=2764, - methods=[ - _descriptor.MethodDescriptor( - name="ListKnowledgeBases", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases", - index=0, - containing_service=None, - input_type=_LISTKNOWLEDGEBASESREQUEST, - output_type=_LISTKNOWLEDGEBASESRESPONSE, - serialized_options=b"\202\323\344\223\002b\022+/v2beta1/{parent=projects/*}/knowledgeBasesZ3\0221/v2beta1/{parent=projects/*/agent}/knowledgeBases\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetKnowledgeBase", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase", - index=1, - containing_service=None, - input_type=_GETKNOWLEDGEBASEREQUEST, - output_type=_KNOWLEDGEBASE, - serialized_options=b"\202\323\344\223\002b\022+/v2beta1/{name=projects/*/knowledgeBases/*}Z3\0221/v2beta1/{name=projects/*/agent/knowledgeBases/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateKnowledgeBase", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase", - index=2, - containing_service=None, - input_type=_CREATEKNOWLEDGEBASEREQUEST, - output_type=_KNOWLEDGEBASE, - serialized_options=b'\202\323\344\223\002\202\001"+/v2beta1/{parent=projects/*}/knowledgeBases:\016knowledge_baseZC"1/v2beta1/{parent=projects/*/agent}/knowledgeBases:\016knowledge_base\332A\025parent,knowledge_base', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteKnowledgeBase", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase", - index=3, - containing_service=None, - input_type=_DELETEKNOWLEDGEBASEREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002b*+/v2beta1/{name=projects/*/knowledgeBases/*}Z3*1/v2beta1/{name=projects/*/agent/knowledgeBases/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateKnowledgeBase", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase", - index=4, - containing_service=None, - input_type=_UPDATEKNOWLEDGEBASEREQUEST, - output_type=_KNOWLEDGEBASE, - serialized_options=b"\202\323\344\223\002\240\0012:/v2beta1/{knowledge_base.name=projects/*/knowledgeBases/*}:\016knowledge_baseZR2@/v2beta1/{knowledge_base.name=projects/*/agent/knowledgeBases/*}:\016knowledge_base\332A\032knowledge_base,update_mask\332A\016knowledge_base", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_KNOWLEDGEBASES) - -DESCRIPTOR.services_by_name["KnowledgeBases"] = _KNOWLEDGEBASES - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/knowledge_base_pb2_grpc.py b/dialogflow_v2beta1/proto/knowledge_base_pb2_grpc.py deleted file mode 100644 index 907b88fda..000000000 --- a/dialogflow_v2beta1/proto/knowledge_base_pb2_grpc.py +++ /dev/null @@ -1,275 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2beta1.proto import ( - knowledge_base_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class KnowledgeBasesStub(object): - """Service for managing [KnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBase]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListKnowledgeBases = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.KnowledgeBases/ListKnowledgeBases", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.ListKnowledgeBasesRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.ListKnowledgeBasesResponse.FromString, - ) - self.GetKnowledgeBase = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.KnowledgeBases/GetKnowledgeBase", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.GetKnowledgeBaseRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.KnowledgeBase.FromString, - ) - self.CreateKnowledgeBase = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.KnowledgeBases/CreateKnowledgeBase", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.CreateKnowledgeBaseRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.KnowledgeBase.FromString, - ) - self.DeleteKnowledgeBase = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.KnowledgeBases/DeleteKnowledgeBase", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.DeleteKnowledgeBaseRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.UpdateKnowledgeBase = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.KnowledgeBases/UpdateKnowledgeBase", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.UpdateKnowledgeBaseRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.KnowledgeBase.FromString, - ) - - -class KnowledgeBasesServicer(object): - """Service for managing [KnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBase]. - """ - - def ListKnowledgeBases(self, request, context): - """Returns the list of all knowledge bases of the specified agent. - - Note: The `projects.agent.knowledgeBases` resource is deprecated; - only use `projects.knowledgeBases`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetKnowledgeBase(self, request, context): - """Retrieves the specified knowledge base. - - Note: The `projects.agent.knowledgeBases` resource is deprecated; - only use `projects.knowledgeBases`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateKnowledgeBase(self, request, context): - """Creates a knowledge base. - - Note: The `projects.agent.knowledgeBases` resource is deprecated; - only use `projects.knowledgeBases`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteKnowledgeBase(self, request, context): - """Deletes the specified knowledge base. - - Note: The `projects.agent.knowledgeBases` resource is deprecated; - only use `projects.knowledgeBases`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateKnowledgeBase(self, request, context): - """Updates the specified knowledge base. - - Note: The `projects.agent.knowledgeBases` resource is deprecated; - only use `projects.knowledgeBases`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_KnowledgeBasesServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListKnowledgeBases": grpc.unary_unary_rpc_method_handler( - servicer.ListKnowledgeBases, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.ListKnowledgeBasesRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.ListKnowledgeBasesResponse.SerializeToString, - ), - "GetKnowledgeBase": grpc.unary_unary_rpc_method_handler( - servicer.GetKnowledgeBase, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.GetKnowledgeBaseRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.KnowledgeBase.SerializeToString, - ), - "CreateKnowledgeBase": grpc.unary_unary_rpc_method_handler( - servicer.CreateKnowledgeBase, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.CreateKnowledgeBaseRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.KnowledgeBase.SerializeToString, - ), - "DeleteKnowledgeBase": grpc.unary_unary_rpc_method_handler( - servicer.DeleteKnowledgeBase, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.DeleteKnowledgeBaseRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "UpdateKnowledgeBase": grpc.unary_unary_rpc_method_handler( - servicer.UpdateKnowledgeBase, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.UpdateKnowledgeBaseRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.KnowledgeBase.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2beta1.KnowledgeBases", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class KnowledgeBases(object): - """Service for managing [KnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBase]. - """ - - @staticmethod - def ListKnowledgeBases( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.KnowledgeBases/ListKnowledgeBases", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.ListKnowledgeBasesRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.ListKnowledgeBasesResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetKnowledgeBase( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.KnowledgeBases/GetKnowledgeBase", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.GetKnowledgeBaseRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.KnowledgeBase.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateKnowledgeBase( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.KnowledgeBases/CreateKnowledgeBase", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.CreateKnowledgeBaseRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.KnowledgeBase.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteKnowledgeBase( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.KnowledgeBases/DeleteKnowledgeBase", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.DeleteKnowledgeBaseRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateKnowledgeBase( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.KnowledgeBases/UpdateKnowledgeBase", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.UpdateKnowledgeBaseRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_knowledge__base__pb2.KnowledgeBase.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2beta1/proto/session_entity_type_pb2.py b/dialogflow_v2beta1/proto/session_entity_type_pb2.py deleted file mode 100644 index c4345692c..000000000 --- a/dialogflow_v2beta1/proto/session_entity_type_pb2.py +++ /dev/null @@ -1,812 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/session_entity_type.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from dialogflow_v2beta1.proto import ( - entity_type_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/session_entity_type.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\026SessionEntityTypeProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n?google/cloud/dialogflow_v2beta1/proto/session_entity_type.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x37google/cloud/dialogflow_v2beta1/proto/entity_type.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\x97\x05\n\x11SessionEntityType\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x63\n\x14\x65ntity_override_mode\x18\x02 \x01(\x0e\x32\x45.google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode\x12\x44\n\x08\x65ntities\x18\x03 \x03(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.EntityType.Entity"\x82\x01\n\x12\x45ntityOverrideMode\x12$\n ENTITY_OVERRIDE_MODE_UNSPECIFIED\x10\x00\x12!\n\x1d\x45NTITY_OVERRIDE_MODE_OVERRIDE\x10\x01\x12#\n\x1f\x45NTITY_OVERRIDE_MODE_SUPPLEMENT\x10\x02:\xc3\x02\xea\x41\xbf\x02\n+dialogflow.googleapis.com/SessionEntityType\x12\x45projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}\x12Zprojects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}\x12mprojects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}"\x8b\x01\n\x1dListSessionEntityTypesRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\x12+dialogflow.googleapis.com/SessionEntityType\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"\x8b\x01\n\x1eListSessionEntityTypesResponse\x12P\n\x14session_entity_types\x18\x01 \x03(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.SessionEntityType\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"`\n\x1bGetSessionEntityTypeRequest\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+dialogflow.googleapis.com/SessionEntityType"\xbb\x01\n\x1e\x43reateSessionEntityTypeRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\x12+dialogflow.googleapis.com/SessionEntityType\x12T\n\x13session_entity_type\x18\x02 \x01(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.SessionEntityTypeB\x03\xe0\x41\x02"\xa7\x01\n\x1eUpdateSessionEntityTypeRequest\x12T\n\x13session_entity_type\x18\x01 \x01(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.SessionEntityTypeB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"c\n\x1e\x44\x65leteSessionEntityTypeRequest\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+dialogflow.googleapis.com/SessionEntityType2\xfb\x15\n\x12SessionEntityTypes\x12\xe4\x03\n\x16ListSessionEntityTypes\x12>.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest\x1a?.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse"\xc8\x02\x82\xd3\xe4\x93\x02\xb8\x02\x12\x39/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypesZR\x12P/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypesZG\x12\x45/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypesZ^\x12\\/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes\xda\x41\x06parent\x12\xd1\x03\n\x14GetSessionEntityType\x12<.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest\x1a\x32.google.cloud.dialogflow.v2beta1.SessionEntityType"\xc6\x02\x82\xd3\xe4\x93\x02\xb8\x02\x12\x39/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}ZR\x12P/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}ZG\x12\x45/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}Z^\x12\\/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}\xda\x41\x04name\x12\xc1\x04\n\x17\x43reateSessionEntityType\x12?.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest\x1a\x32.google.cloud.dialogflow.v2beta1.SessionEntityType"\xb0\x03\x82\xd3\xe4\x93\x02\x8c\x03"9/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes:\x13session_entity_typeZg"P/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes:\x13session_entity_typeZ\\"E/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes:\x13session_entity_typeZs"\\/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes:\x13session_entity_type\xda\x41\x1aparent,session_entity_type\x12\xad\x05\n\x17UpdateSessionEntityType\x12?.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest\x1a\x32.google.cloud.dialogflow.v2beta1.SessionEntityType"\x9c\x04\x82\xd3\xe4\x93\x02\xdd\x03\x32M/v2beta1/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}:\x13session_entity_typeZ{2d/v2beta1/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}:\x13session_entity_typeZp2Y/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/sessions/*/entityTypes/*}:\x13session_entity_typeZ\x87\x01\x32p/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}:\x13session_entity_type\xda\x41\x13session_entity_type\xda\x41\x1fsession_entity_type,update_mask\x12\xbb\x03\n\x17\x44\x65leteSessionEntityType\x12?.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest\x1a\x16.google.protobuf.Empty"\xc6\x02\x82\xd3\xe4\x93\x02\xb8\x02*9/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}ZR*P/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}ZG*E/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}Z^*\\/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}\xda\x41\x04name\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\xb4\x01\n#com.google.cloud.dialogflow.v2beta1B\x16SessionEntityTypeProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - ], -) - - -_SESSIONENTITYTYPE_ENTITYOVERRIDEMODE = _descriptor.EnumDescriptor( - name="EntityOverrideMode", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="ENTITY_OVERRIDE_MODE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ENTITY_OVERRIDE_MODE_OVERRIDE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ENTITY_OVERRIDE_MODE_SUPPLEMENT", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=543, - serialized_end=673, -) -_sym_db.RegisterEnumDescriptor(_SESSIONENTITYTYPE_ENTITYOVERRIDEMODE) - - -_SESSIONENTITYTYPE = _descriptor.Descriptor( - name="SessionEntityType", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityType", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityType.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entity_override_mode", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityType.entity_override_mode", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entities", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityType.entities", - index=2, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_SESSIONENTITYTYPE_ENTITYOVERRIDEMODE], - serialized_options=b"\352A\277\002\n+dialogflow.googleapis.com/SessionEntityType\022Eprojects/{project}/agent/sessions/{session}/entityTypes/{entity_type}\022Zprojects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}\022mprojects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=336, - serialized_end=999, -) - - -_LISTSESSIONENTITYTYPESREQUEST = _descriptor.Descriptor( - name="ListSessionEntityTypesRequest", - full_name="google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\022+dialogflow.googleapis.com/SessionEntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1002, - serialized_end=1141, -) - - -_LISTSESSIONENTITYTYPESRESPONSE = _descriptor.Descriptor( - name="ListSessionEntityTypesResponse", - full_name="google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="session_entity_types", - full_name="google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse.session_entity_types", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1144, - serialized_end=1283, -) - - -_GETSESSIONENTITYTYPEREQUEST = _descriptor.Descriptor( - name="GetSessionEntityTypeRequest", - full_name="google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\n+dialogflow.googleapis.com/SessionEntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1285, - serialized_end=1381, -) - - -_CREATESESSIONENTITYTYPEREQUEST = _descriptor.Descriptor( - name="CreateSessionEntityTypeRequest", - full_name="google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\022+dialogflow.googleapis.com/SessionEntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="session_entity_type", - full_name="google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest.session_entity_type", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1384, - serialized_end=1571, -) - - -_UPDATESESSIONENTITYTYPEREQUEST = _descriptor.Descriptor( - name="UpdateSessionEntityTypeRequest", - full_name="google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="session_entity_type", - full_name="google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest.session_entity_type", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1574, - serialized_end=1741, -) - - -_DELETESESSIONENTITYTYPEREQUEST = _descriptor.Descriptor( - name="DeleteSessionEntityTypeRequest", - full_name="google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\n+dialogflow.googleapis.com/SessionEntityType", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1743, - serialized_end=1842, -) - -_SESSIONENTITYTYPE.fields_by_name[ - "entity_override_mode" -].enum_type = _SESSIONENTITYTYPE_ENTITYOVERRIDEMODE -_SESSIONENTITYTYPE.fields_by_name[ - "entities" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_entity__type__pb2._ENTITYTYPE_ENTITY -) -_SESSIONENTITYTYPE_ENTITYOVERRIDEMODE.containing_type = _SESSIONENTITYTYPE -_LISTSESSIONENTITYTYPESRESPONSE.fields_by_name[ - "session_entity_types" -].message_type = _SESSIONENTITYTYPE -_CREATESESSIONENTITYTYPEREQUEST.fields_by_name[ - "session_entity_type" -].message_type = _SESSIONENTITYTYPE -_UPDATESESSIONENTITYTYPEREQUEST.fields_by_name[ - "session_entity_type" -].message_type = _SESSIONENTITYTYPE -_UPDATESESSIONENTITYTYPEREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -DESCRIPTOR.message_types_by_name["SessionEntityType"] = _SESSIONENTITYTYPE -DESCRIPTOR.message_types_by_name[ - "ListSessionEntityTypesRequest" -] = _LISTSESSIONENTITYTYPESREQUEST -DESCRIPTOR.message_types_by_name[ - "ListSessionEntityTypesResponse" -] = _LISTSESSIONENTITYTYPESRESPONSE -DESCRIPTOR.message_types_by_name[ - "GetSessionEntityTypeRequest" -] = _GETSESSIONENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name[ - "CreateSessionEntityTypeRequest" -] = _CREATESESSIONENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name[ - "UpdateSessionEntityTypeRequest" -] = _UPDATESESSIONENTITYTYPEREQUEST -DESCRIPTOR.message_types_by_name[ - "DeleteSessionEntityTypeRequest" -] = _DELETESESSIONENTITYTYPEREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -SessionEntityType = _reflection.GeneratedProtocolMessageType( - "SessionEntityType", - (_message.Message,), - { - "DESCRIPTOR": _SESSIONENTITYTYPE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_entity_type_pb2", - "__doc__": """A session represents a conversation between a Dialogflow agent and an - end-user. You can create special entities, called session entities, - during a session. Session entities can extend or replace custom entity - types and only exist during the session that they were created for. - All session data, including session entities, is stored by Dialogflow - for 20 minutes. For more information, see the `session entity guide - `__. - - Attributes: - name: - Required. The unique identifier of this session entity type. - Format: ``projects//agent/sessions//entityTypes/``, or - ``projects//agent/environments//users//sessions//entityTypes/``. If ``Environment ID`` is not specified, - we assume default ‘draft’ environment. If ``User ID`` is not - specified, we assume default ‘-’ user. ```` must be the display name of an existing entity type in - the same agent that will be overridden or supplemented. - entity_override_mode: - Required. Indicates whether the additional data should - override or supplement the custom entity type definition. - entities: - Required. The collection of entities associated with this - session entity type. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.SessionEntityType) - }, -) -_sym_db.RegisterMessage(SessionEntityType) - -ListSessionEntityTypesRequest = _reflection.GeneratedProtocolMessageType( - "ListSessionEntityTypesRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTSESSIONENTITYTYPESREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_entity_type_pb2", - "__doc__": """The request message for [SessionEntityTypes.ListSessionEntityTypes][go - ogle.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityType - s]. - - Attributes: - parent: - Required. The session to list all session entity types from. - Format: ``projects//agent/sessions/`` - or ``projects//agent/environments//users// sessions/``. If ``Environment - ID`` is not specified, we assume default ‘draft’ environment. - If ``User ID`` is not specified, we assume default ‘-’ user. - page_size: - Optional. The maximum number of items to return in a single - page. By default 100 and at most 1000. - page_token: - Optional. The next_page_token value returned from a previous - list request. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest) - }, -) -_sym_db.RegisterMessage(ListSessionEntityTypesRequest) - -ListSessionEntityTypesResponse = _reflection.GeneratedProtocolMessageType( - "ListSessionEntityTypesResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTSESSIONENTITYTYPESRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_entity_type_pb2", - "__doc__": """The response message for [SessionEntityTypes.ListSessionEntityTypes][g - oogle.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTyp - es]. - - Attributes: - session_entity_types: - The list of session entity types. There will be a maximum - number of items returned based on the page_size field in the - request. - next_page_token: - Token to retrieve the next page of results, or empty if there - are no more results in the list. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse) - }, -) -_sym_db.RegisterMessage(ListSessionEntityTypesResponse) - -GetSessionEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "GetSessionEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETSESSIONENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_entity_type_pb2", - "__doc__": """The request message for [SessionEntityTypes.GetSessionEntityType][goog - le.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType]. - - Attributes: - name: - Required. The name of the session entity type. Format: - ``projects//agent/sessions//entityTypes/`` or - ``projects//agent/environments//users//sessions//entityTypes/``. If ``Environment ID`` is not specified, - we assume default ‘draft’ environment. If ``User ID`` is not - specified, we assume default ‘-’ user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(GetSessionEntityTypeRequest) - -CreateSessionEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "CreateSessionEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATESESSIONENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_entity_type_pb2", - "__doc__": """The request message for [SessionEntityTypes.CreateSessionEntityType][g - oogle.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityT - ype]. - - Attributes: - parent: - Required. The session to create a session entity type for. - Format: ``projects//agent/sessions/`` - or ``projects//agent/environments//users// sessions/``. If ``Environment - ID`` is not specified, we assume default ‘draft’ environment. - If ``User ID`` is not specified, we assume default ‘-’ user. - session_entity_type: - Required. The session entity type to create. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(CreateSessionEntityTypeRequest) - -UpdateSessionEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "UpdateSessionEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATESESSIONENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_entity_type_pb2", - "__doc__": """The request message for [SessionEntityTypes.UpdateSessionEntityType][g - oogle.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityT - ype]. - - Attributes: - session_entity_type: - Required. The session entity type to update. - update_mask: - Optional. The mask to control which fields get updated. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(UpdateSessionEntityTypeRequest) - -DeleteSessionEntityTypeRequest = _reflection.GeneratedProtocolMessageType( - "DeleteSessionEntityTypeRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETESESSIONENTITYTYPEREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_entity_type_pb2", - "__doc__": """The request message for [SessionEntityTypes.DeleteSessionEntityType][g - oogle.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityT - ype]. - - Attributes: - name: - Required. The name of the entity type to delete. Format: - ``projects//agent/sessions//entityTypes/`` or - ``projects//agent/environments//users//sessions//entityTypes/``. If ``Environment ID`` is not specified, - we assume default ‘draft’ environment. If ``User ID`` is not - specified, we assume default ‘-’ user. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest) - }, -) -_sym_db.RegisterMessage(DeleteSessionEntityTypeRequest) - - -DESCRIPTOR._options = None -_SESSIONENTITYTYPE._options = None -_LISTSESSIONENTITYTYPESREQUEST.fields_by_name["parent"]._options = None -_GETSESSIONENTITYTYPEREQUEST.fields_by_name["name"]._options = None -_CREATESESSIONENTITYTYPEREQUEST.fields_by_name["parent"]._options = None -_CREATESESSIONENTITYTYPEREQUEST.fields_by_name["session_entity_type"]._options = None -_UPDATESESSIONENTITYTYPEREQUEST.fields_by_name["session_entity_type"]._options = None -_DELETESESSIONENTITYTYPEREQUEST.fields_by_name["name"]._options = None - -_SESSIONENTITYTYPES = _descriptor.ServiceDescriptor( - name="SessionEntityTypes", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityTypes", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=1845, - serialized_end=4656, - methods=[ - _descriptor.MethodDescriptor( - name="ListSessionEntityTypes", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes", - index=0, - containing_service=None, - input_type=_LISTSESSIONENTITYTYPESREQUEST, - output_type=_LISTSESSIONENTITYTYPESRESPONSE, - serialized_options=b"\202\323\344\223\002\270\002\0229/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypesZR\022P/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypesZG\022E/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypesZ^\022\\/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetSessionEntityType", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType", - index=1, - containing_service=None, - input_type=_GETSESSIONENTITYTYPEREQUEST, - output_type=_SESSIONENTITYTYPE, - serialized_options=b"\202\323\344\223\002\270\002\0229/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}ZR\022P/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}ZG\022E/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}Z^\022\\/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateSessionEntityType", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType", - index=2, - containing_service=None, - input_type=_CREATESESSIONENTITYTYPEREQUEST, - output_type=_SESSIONENTITYTYPE, - serialized_options=b'\202\323\344\223\002\214\003"9/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes:\023session_entity_typeZg"P/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes:\023session_entity_typeZ\\"E/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes:\023session_entity_typeZs"\\/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes:\023session_entity_type\332A\032parent,session_entity_type', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateSessionEntityType", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType", - index=3, - containing_service=None, - input_type=_UPDATESESSIONENTITYTYPEREQUEST, - output_type=_SESSIONENTITYTYPE, - serialized_options=b"\202\323\344\223\002\335\0032M/v2beta1/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}:\023session_entity_typeZ{2d/v2beta1/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}:\023session_entity_typeZp2Y/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/sessions/*/entityTypes/*}:\023session_entity_typeZ\207\0012p/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}:\023session_entity_type\332A\023session_entity_type\332A\037session_entity_type,update_mask", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteSessionEntityType", - full_name="google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType", - index=4, - containing_service=None, - input_type=_DELETESESSIONENTITYTYPEREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002\270\002*9/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}ZR*P/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}ZG*E/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}Z^*\\/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_SESSIONENTITYTYPES) - -DESCRIPTOR.services_by_name["SessionEntityTypes"] = _SESSIONENTITYTYPES - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/session_entity_type_pb2_grpc.py b/dialogflow_v2beta1/proto/session_entity_type_pb2_grpc.py deleted file mode 100644 index 011f6068c..000000000 --- a/dialogflow_v2beta1/proto/session_entity_type_pb2_grpc.py +++ /dev/null @@ -1,283 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2beta1.proto import ( - session_entity_type_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class SessionEntityTypesStub(object): - """Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityType]. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListSessionEntityTypes = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/ListSessionEntityTypes", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesResponse.FromString, - ) - self.GetSessionEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/GetSessionEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.GetSessionEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - ) - self.CreateSessionEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/CreateSessionEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.CreateSessionEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - ) - self.UpdateSessionEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/UpdateSessionEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.UpdateSessionEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - ) - self.DeleteSessionEntityType = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/DeleteSessionEntityType", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.DeleteSessionEntityTypeRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - - -class SessionEntityTypesServicer(object): - """Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityType]. - """ - - def ListSessionEntityTypes(self, request, context): - """Returns the list of all session entity types in the specified session. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetSessionEntityType(self, request, context): - """Retrieves the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateSessionEntityType(self, request, context): - """Creates a session entity type. - - If the specified session entity type already exists, overrides the - session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateSessionEntityType(self, request, context): - """Updates the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteSessionEntityType(self, request, context): - """Deletes the specified session entity type. - - This method doesn't work with Google Assistant integration. - Contact Dialogflow support if you need to use session entities - with Google Assistant integration. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_SessionEntityTypesServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListSessionEntityTypes": grpc.unary_unary_rpc_method_handler( - servicer.ListSessionEntityTypes, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesResponse.SerializeToString, - ), - "GetSessionEntityType": grpc.unary_unary_rpc_method_handler( - servicer.GetSessionEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.GetSessionEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.SessionEntityType.SerializeToString, - ), - "CreateSessionEntityType": grpc.unary_unary_rpc_method_handler( - servicer.CreateSessionEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.CreateSessionEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.SessionEntityType.SerializeToString, - ), - "UpdateSessionEntityType": grpc.unary_unary_rpc_method_handler( - servicer.UpdateSessionEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.UpdateSessionEntityTypeRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.SessionEntityType.SerializeToString, - ), - "DeleteSessionEntityType": grpc.unary_unary_rpc_method_handler( - servicer.DeleteSessionEntityType, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.DeleteSessionEntityTypeRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2beta1.SessionEntityTypes", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class SessionEntityTypes(object): - """Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityType]. - """ - - @staticmethod - def ListSessionEntityTypes( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/ListSessionEntityTypes", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.ListSessionEntityTypesResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetSessionEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/GetSessionEntityType", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.GetSessionEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateSessionEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/CreateSessionEntityType", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.CreateSessionEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateSessionEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/UpdateSessionEntityType", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.UpdateSessionEntityTypeRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.SessionEntityType.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteSessionEntityType( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/DeleteSessionEntityType", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.DeleteSessionEntityTypeRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2beta1/proto/session_pb2.py b/dialogflow_v2beta1/proto/session_pb2.py deleted file mode 100644 index 40ab9e01b..000000000 --- a/dialogflow_v2beta1/proto/session_pb2.py +++ /dev/null @@ -1,2955 +0,0 @@ -# -*- coding: utf-8 -*- -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/session.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from dialogflow_v2beta1.proto import ( - agent_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2, -) -from dialogflow_v2beta1.proto import ( - audio_config_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2, -) -from dialogflow_v2beta1.proto import ( - context_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2, -) -from dialogflow_v2beta1.proto import ( - intent_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2, -) -from dialogflow_v2beta1.proto import ( - session_entity_type_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2, -) -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 -from google.rpc import status_pb2 as google_dot_rpc_dot_status__pb2 -from google.type import latlng_pb2 as google_dot_type_dot_latlng__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/session.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\014SessionProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1\352A\347\001\n!dialogflow.googleapis.com/Session\022+projects/{project}/agent/sessions/{session}\022Sprojects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}\022@projects/{project}/locations/{location}/agent/sessions/{session}", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n3google/cloud/dialogflow_v2beta1/proto/session.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x31google/cloud/dialogflow_v2beta1/proto/agent.proto\x1a\x38google/cloud/dialogflow_v2beta1/proto/audio_config.proto\x1a\x33google/cloud/dialogflow_v2beta1/proto/context.proto\x1a\x32google/cloud/dialogflow_v2beta1/proto/intent.proto\x1a?google/cloud/dialogflow_v2beta1/proto/session_entity_type.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x17google/rpc/status.proto\x1a\x18google/type/latlng.proto"\x84\x03\n\x13\x44\x65tectIntentRequest\x12:\n\x07session\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!dialogflow.googleapis.com/Session\x12\x46\n\x0cquery_params\x18\x02 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2beta1.QueryParameters\x12\x45\n\x0bquery_input\x18\x03 \x01(\x0b\x32+.google.cloud.dialogflow.v2beta1.QueryInputB\x03\xe0\x41\x02\x12O\n\x13output_audio_config\x18\x04 \x01(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.OutputAudioConfig\x12<\n\x18output_audio_config_mask\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x13\n\x0binput_audio\x18\x05 \x01(\x0c"\xd3\x02\n\x14\x44\x65tectIntentResponse\x12\x13\n\x0bresponse_id\x18\x01 \x01(\t\x12\x42\n\x0cquery_result\x18\x02 \x01(\x0b\x32,.google.cloud.dialogflow.v2beta1.QueryResult\x12O\n\x19\x61lternative_query_results\x18\x05 \x03(\x0b\x32,.google.cloud.dialogflow.v2beta1.QueryResult\x12*\n\x0ewebhook_status\x18\x03 \x01(\x0b\x32\x12.google.rpc.Status\x12\x14\n\x0coutput_audio\x18\x04 \x01(\x0c\x12O\n\x13output_audio_config\x18\x06 \x01(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.OutputAudioConfig"\xfe\x04\n\x0fQueryParameters\x12\x11\n\ttime_zone\x18\x01 \x01(\t\x12)\n\x0cgeo_location\x18\x02 \x01(\x0b\x32\x13.google.type.LatLng\x12:\n\x08\x63ontexts\x18\x03 \x03(\x0b\x32(.google.cloud.dialogflow.v2beta1.Context\x12\x16\n\x0ereset_contexts\x18\x04 \x01(\x08\x12P\n\x14session_entity_types\x18\x05 \x03(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.SessionEntityType\x12(\n\x07payload\x18\x06 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x1c\n\x14knowledge_base_names\x18\x0c \x03(\t\x12j\n!sentiment_analysis_request_config\x18\n \x01(\x0b\x32?.google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig\x12=\n\nsub_agents\x18\r \x03(\x0b\x32).google.cloud.dialogflow.v2beta1.SubAgent\x12]\n\x0fwebhook_headers\x18\x0e \x03(\x0b\x32\x44.google.cloud.dialogflow.v2beta1.QueryParameters.WebhookHeadersEntry\x1a\x35\n\x13WebhookHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\xda\x01\n\nQueryInput\x12I\n\x0c\x61udio_config\x18\x01 \x01(\x0b\x32\x31.google.cloud.dialogflow.v2beta1.InputAudioConfigH\x00\x12:\n\x04text\x18\x02 \x01(\x0b\x32*.google.cloud.dialogflow.v2beta1.TextInputH\x00\x12<\n\x05\x65vent\x18\x03 \x01(\x0b\x32+.google.cloud.dialogflow.v2beta1.EventInputH\x00\x42\x07\n\x05input"\xf2\x05\n\x0bQueryResult\x12\x12\n\nquery_text\x18\x01 \x01(\t\x12\x15\n\rlanguage_code\x18\x0f \x01(\t\x12%\n\x1dspeech_recognition_confidence\x18\x02 \x01(\x02\x12\x0e\n\x06\x61\x63tion\x18\x03 \x01(\t\x12+\n\nparameters\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12#\n\x1b\x61ll_required_params_present\x18\x05 \x01(\x08\x12\x18\n\x10\x66ulfillment_text\x18\x06 \x01(\t\x12M\n\x14\x66ulfillment_messages\x18\x07 \x03(\x0b\x32/.google.cloud.dialogflow.v2beta1.Intent.Message\x12\x16\n\x0ewebhook_source\x18\x08 \x01(\t\x12\x30\n\x0fwebhook_payload\x18\t \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x41\n\x0foutput_contexts\x18\n \x03(\x0b\x32(.google.cloud.dialogflow.v2beta1.Context\x12\x37\n\x06intent\x18\x0b \x01(\x0b\x32\'.google.cloud.dialogflow.v2beta1.Intent\x12#\n\x1bintent_detection_confidence\x18\x0c \x01(\x02\x12\x30\n\x0f\x64iagnostic_info\x18\x0e \x01(\x0b\x32\x17.google.protobuf.Struct\x12[\n\x19sentiment_analysis_result\x18\x11 \x01(\x0b\x32\x38.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult\x12L\n\x11knowledge_answers\x18\x12 \x01(\x0b\x32\x31.google.cloud.dialogflow.v2beta1.KnowledgeAnswers"\xaf\x03\n\x10KnowledgeAnswers\x12I\n\x07\x61nswers\x18\x01 \x03(\x0b\x32\x38.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer\x1a\xcf\x02\n\x06\x41nswer\x12\x37\n\x06source\x18\x01 \x01(\tB\'\xfa\x41$\n"dialogflow.googleapis.com/Document\x12\x14\n\x0c\x66\x61q_question\x18\x02 \x01(\t\x12\x0e\n\x06\x61nswer\x18\x03 \x01(\t\x12m\n\x16match_confidence_level\x18\x04 \x01(\x0e\x32M.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel\x12\x18\n\x10match_confidence\x18\x05 \x01(\x02"]\n\x14MatchConfidenceLevel\x12&\n"MATCH_CONFIDENCE_LEVEL_UNSPECIFIED\x10\x00\x12\x07\n\x03LOW\x10\x01\x12\n\n\x06MEDIUM\x10\x02\x12\x08\n\x04HIGH\x10\x03"\x81\x03\n\x1cStreamingDetectIntentRequest\x12\x14\n\x07session\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x46\n\x0cquery_params\x18\x02 \x01(\x0b\x32\x30.google.cloud.dialogflow.v2beta1.QueryParameters\x12\x45\n\x0bquery_input\x18\x03 \x01(\x0b\x32+.google.cloud.dialogflow.v2beta1.QueryInputB\x03\xe0\x41\x02\x12\x18\n\x10single_utterance\x18\x04 \x01(\x08\x12O\n\x13output_audio_config\x18\x05 \x01(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.OutputAudioConfig\x12<\n\x18output_audio_config_mask\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x13\n\x0binput_audio\x18\x06 \x01(\x0c"\xb5\x03\n\x1dStreamingDetectIntentResponse\x12\x13\n\x0bresponse_id\x18\x01 \x01(\t\x12W\n\x12recognition_result\x18\x02 \x01(\x0b\x32;.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult\x12\x42\n\x0cquery_result\x18\x03 \x01(\x0b\x32,.google.cloud.dialogflow.v2beta1.QueryResult\x12O\n\x19\x61lternative_query_results\x18\x07 \x03(\x0b\x32,.google.cloud.dialogflow.v2beta1.QueryResult\x12*\n\x0ewebhook_status\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\x12\x14\n\x0coutput_audio\x18\x05 \x01(\x0c\x12O\n\x13output_audio_config\x18\x06 \x01(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.OutputAudioConfig"\xa3\x03\n\x1aStreamingRecognitionResult\x12]\n\x0cmessage_type\x18\x01 \x01(\x0e\x32G.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType\x12\x12\n\ntranscript\x18\x02 \x01(\t\x12\x10\n\x08is_final\x18\x03 \x01(\x08\x12\x12\n\nconfidence\x18\x04 \x01(\x02\x12\x11\n\tstability\x18\x06 \x01(\x02\x12I\n\x10speech_word_info\x18\x07 \x03(\x0b\x32/.google.cloud.dialogflow.v2beta1.SpeechWordInfo\x12\x34\n\x11speech_end_offset\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration"X\n\x0bMessageType\x12\x1c\n\x18MESSAGE_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nTRANSCRIPT\x10\x01\x12\x1b\n\x17\x45ND_OF_SINGLE_UTTERANCE\x10\x02"0\n\tTextInput\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x15\n\rlanguage_code\x18\x02 \x01(\t"^\n\nEventInput\x12\x0c\n\x04name\x18\x01 \x01(\t\x12+\n\nparameters\x18\x02 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x15\n\rlanguage_code\x18\x03 \x01(\t"F\n\x1eSentimentAnalysisRequestConfig\x12$\n\x1c\x61nalyze_query_text_sentiment\x18\x01 \x01(\x08"c\n\x17SentimentAnalysisResult\x12H\n\x14query_text_sentiment\x18\x01 \x01(\x0b\x32*.google.cloud.dialogflow.v2beta1.Sentiment"-\n\tSentiment\x12\r\n\x05score\x18\x01 \x01(\x02\x12\x11\n\tmagnitude\x18\x02 \x01(\x02\x32\x8d\x06\n\x08Sessions\x12\xe7\x03\n\x0c\x44\x65tectIntent\x12\x34.google.cloud.dialogflow.v2beta1.DetectIntentRequest\x1a\x35.google.cloud.dialogflow.v2beta1.DetectIntentResponse"\xe9\x02\x82\xd3\xe4\x93\x02\xcc\x02";/v2beta1/{session=projects/*/agent/sessions/*}:detectIntent:\x01*ZW"R/v2beta1/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent:\x01*ZL"G/v2beta1/{session=projects/*/locations/*/agent/sessions/*}:detectIntent:\x01*Zc"^/v2beta1/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent:\x01*\xda\x41\x13session,query_input\x12\x9c\x01\n\x15StreamingDetectIntent\x12=.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest\x1a>.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse"\x00(\x01\x30\x01\x1ax\xca\x41\x19\x64ialogflow.googleapis.com\xd2\x41Yhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB\x95\x03\n#com.google.cloud.dialogflow.v2beta1B\x0cSessionProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1\xea\x41\xe7\x01\n!dialogflow.googleapis.com/Session\x12+projects/{project}/agent/sessions/{session}\x12Sprojects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}\x12@projects/{project}/locations/{location}/agent/sessions/{session}b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.DESCRIPTOR, - google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, - google_dot_rpc_dot_status__pb2.DESCRIPTOR, - google_dot_type_dot_latlng__pb2.DESCRIPTOR, - ], -) - - -_KNOWLEDGEANSWERS_ANSWER_MATCHCONFIDENCELEVEL = _descriptor.EnumDescriptor( - name="MatchConfidenceLevel", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="MATCH_CONFIDENCE_LEVEL_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LOW", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MEDIUM", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="HIGH", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=3320, - serialized_end=3413, -) -_sym_db.RegisterEnumDescriptor(_KNOWLEDGEANSWERS_ANSWER_MATCHCONFIDENCELEVEL) - -_STREAMINGRECOGNITIONRESULT_MESSAGETYPE = _descriptor.EnumDescriptor( - name="MessageType", - full_name="google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="MESSAGE_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TRANSCRIPT", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="END_OF_SINGLE_UTTERANCE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=4575, - serialized_end=4663, -) -_sym_db.RegisterEnumDescriptor(_STREAMINGRECOGNITIONRESULT_MESSAGETYPE) - - -_DETECTINTENTREQUEST = _descriptor.Descriptor( - name="DetectIntentRequest", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="session", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentRequest.session", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A#\n!dialogflow.googleapis.com/Session", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_params", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentRequest.query_params", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_input", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentRequest.query_input", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config_mask", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config_mask", - index=4, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="input_audio", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentRequest.input_audio", - index=5, - number=5, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=630, - serialized_end=1018, -) - - -_DETECTINTENTRESPONSE = _descriptor.Descriptor( - name="DetectIntentResponse", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="response_id", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentResponse.response_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_result", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentResponse.query_result", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="alternative_query_results", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentResponse.alternative_query_results", - index=2, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_status", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentResponse.webhook_status", - index=3, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentResponse.output_audio", - index=4, - number=4, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config", - full_name="google.cloud.dialogflow.v2beta1.DetectIntentResponse.output_audio_config", - index=5, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1021, - serialized_end=1360, -) - - -_QUERYPARAMETERS_WEBHOOKHEADERSENTRY = _descriptor.Descriptor( - name="WebhookHeadersEntry", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.WebhookHeadersEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.WebhookHeadersEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.WebhookHeadersEntry.value", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1948, - serialized_end=2001, -) - -_QUERYPARAMETERS = _descriptor.Descriptor( - name="QueryParameters", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="time_zone", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.time_zone", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="geo_location", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.geo_location", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="contexts", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.contexts", - index=2, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="reset_contexts", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.reset_contexts", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="session_entity_types", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.session_entity_types", - index=4, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="payload", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.payload", - index=5, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="knowledge_base_names", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.knowledge_base_names", - index=6, - number=12, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sentiment_analysis_request_config", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.sentiment_analysis_request_config", - index=7, - number=10, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sub_agents", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.sub_agents", - index=8, - number=13, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_headers", - full_name="google.cloud.dialogflow.v2beta1.QueryParameters.webhook_headers", - index=9, - number=14, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_QUERYPARAMETERS_WEBHOOKHEADERSENTRY], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1363, - serialized_end=2001, -) - - -_QUERYINPUT = _descriptor.Descriptor( - name="QueryInput", - full_name="google.cloud.dialogflow.v2beta1.QueryInput", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="audio_config", - full_name="google.cloud.dialogflow.v2beta1.QueryInput.audio_config", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.QueryInput.text", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="event", - full_name="google.cloud.dialogflow.v2beta1.QueryInput.event", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="input", - full_name="google.cloud.dialogflow.v2beta1.QueryInput.input", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ) - ], - serialized_start=2004, - serialized_end=2222, -) - - -_QUERYRESULT = _descriptor.Descriptor( - name="QueryResult", - full_name="google.cloud.dialogflow.v2beta1.QueryResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="query_text", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.query_text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.language_code", - index=1, - number=15, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="speech_recognition_confidence", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.speech_recognition_confidence", - index=2, - number=2, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="action", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.action", - index=3, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parameters", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.parameters", - index=4, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="all_required_params_present", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.all_required_params_present", - index=5, - number=5, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="fulfillment_text", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_text", - index=6, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="fulfillment_messages", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_messages", - index=7, - number=7, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_source", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.webhook_source", - index=8, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_payload", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.webhook_payload", - index=9, - number=9, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_contexts", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.output_contexts", - index=10, - number=10, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.intent", - index=11, - number=11, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="intent_detection_confidence", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.intent_detection_confidence", - index=12, - number=12, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="diagnostic_info", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.diagnostic_info", - index=13, - number=14, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sentiment_analysis_result", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.sentiment_analysis_result", - index=14, - number=17, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="knowledge_answers", - full_name="google.cloud.dialogflow.v2beta1.QueryResult.knowledge_answers", - index=15, - number=18, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2225, - serialized_end=2979, -) - - -_KNOWLEDGEANSWERS_ANSWER = _descriptor.Descriptor( - name="Answer", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="source", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.source", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\372A$\n"dialogflow.googleapis.com/Document', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="faq_question", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.faq_question", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="answer", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.answer", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="match_confidence_level", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.match_confidence_level", - index=3, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="match_confidence", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.match_confidence", - index=4, - number=5, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_KNOWLEDGEANSWERS_ANSWER_MATCHCONFIDENCELEVEL], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3078, - serialized_end=3413, -) - -_KNOWLEDGEANSWERS = _descriptor.Descriptor( - name="KnowledgeAnswers", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeAnswers", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="answers", - full_name="google.cloud.dialogflow.v2beta1.KnowledgeAnswers.answers", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[_KNOWLEDGEANSWERS_ANSWER], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2982, - serialized_end=3413, -) - - -_STREAMINGDETECTINTENTREQUEST = _descriptor.Descriptor( - name="StreamingDetectIntentRequest", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="session", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.session", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_params", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_input", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="single_utterance", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.single_utterance", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config_mask", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config_mask", - index=5, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="input_audio", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio", - index=6, - number=6, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3416, - serialized_end=3801, -) - - -_STREAMINGDETECTINTENTRESPONSE = _descriptor.Descriptor( - name="StreamingDetectIntentResponse", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="response_id", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.response_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="recognition_result", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.recognition_result", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_result", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.query_result", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="alternative_query_results", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.alternative_query_results", - index=3, - number=7, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="webhook_status", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.webhook_status", - index=4, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.output_audio", - index=5, - number=5, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_audio_config", - full_name="google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.output_audio_config", - index=6, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3804, - serialized_end=4241, -) - - -_STREAMINGRECOGNITIONRESULT = _descriptor.Descriptor( - name="StreamingRecognitionResult", - full_name="google.cloud.dialogflow.v2beta1.StreamingRecognitionResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="message_type", - full_name="google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.message_type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="transcript", - full_name="google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.transcript", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_final", - full_name="google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.is_final", - index=2, - number=3, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="confidence", - full_name="google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.confidence", - index=3, - number=4, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="stability", - full_name="google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.stability", - index=4, - number=6, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="speech_word_info", - full_name="google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.speech_word_info", - index=5, - number=7, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="speech_end_offset", - full_name="google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.speech_end_offset", - index=6, - number=8, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_STREAMINGRECOGNITIONRESULT_MESSAGETYPE], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4244, - serialized_end=4663, -) - - -_TEXTINPUT = _descriptor.Descriptor( - name="TextInput", - full_name="google.cloud.dialogflow.v2beta1.TextInput", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="text", - full_name="google.cloud.dialogflow.v2beta1.TextInput.text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.TextInput.language_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4665, - serialized_end=4713, -) - - -_EVENTINPUT = _descriptor.Descriptor( - name="EventInput", - full_name="google.cloud.dialogflow.v2beta1.EventInput", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.dialogflow.v2beta1.EventInput.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="parameters", - full_name="google.cloud.dialogflow.v2beta1.EventInput.parameters", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.dialogflow.v2beta1.EventInput.language_code", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4715, - serialized_end=4809, -) - - -_SENTIMENTANALYSISREQUESTCONFIG = _descriptor.Descriptor( - name="SentimentAnalysisRequestConfig", - full_name="google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="analyze_query_text_sentiment", - full_name="google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig.analyze_query_text_sentiment", - index=0, - number=1, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4811, - serialized_end=4881, -) - - -_SENTIMENTANALYSISRESULT = _descriptor.Descriptor( - name="SentimentAnalysisResult", - full_name="google.cloud.dialogflow.v2beta1.SentimentAnalysisResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="query_text_sentiment", - full_name="google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.query_text_sentiment", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4883, - serialized_end=4982, -) - - -_SENTIMENT = _descriptor.Descriptor( - name="Sentiment", - full_name="google.cloud.dialogflow.v2beta1.Sentiment", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="score", - full_name="google.cloud.dialogflow.v2beta1.Sentiment.score", - index=0, - number=1, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="magnitude", - full_name="google.cloud.dialogflow.v2beta1.Sentiment.magnitude", - index=1, - number=2, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4984, - serialized_end=5029, -) - -_DETECTINTENTREQUEST.fields_by_name["query_params"].message_type = _QUERYPARAMETERS -_DETECTINTENTREQUEST.fields_by_name["query_input"].message_type = _QUERYINPUT -_DETECTINTENTREQUEST.fields_by_name[ - "output_audio_config" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2._OUTPUTAUDIOCONFIG -) -_DETECTINTENTREQUEST.fields_by_name[ - "output_audio_config_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_DETECTINTENTRESPONSE.fields_by_name["query_result"].message_type = _QUERYRESULT -_DETECTINTENTRESPONSE.fields_by_name[ - "alternative_query_results" -].message_type = _QUERYRESULT -_DETECTINTENTRESPONSE.fields_by_name[ - "webhook_status" -].message_type = google_dot_rpc_dot_status__pb2._STATUS -_DETECTINTENTRESPONSE.fields_by_name[ - "output_audio_config" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2._OUTPUTAUDIOCONFIG -) -_QUERYPARAMETERS_WEBHOOKHEADERSENTRY.containing_type = _QUERYPARAMETERS -_QUERYPARAMETERS.fields_by_name[ - "geo_location" -].message_type = google_dot_type_dot_latlng__pb2._LATLNG -_QUERYPARAMETERS.fields_by_name[ - "contexts" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2._CONTEXT -) -_QUERYPARAMETERS.fields_by_name[ - "session_entity_types" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2._SESSIONENTITYTYPE -) -_QUERYPARAMETERS.fields_by_name[ - "payload" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_QUERYPARAMETERS.fields_by_name[ - "sentiment_analysis_request_config" -].message_type = _SENTIMENTANALYSISREQUESTCONFIG -_QUERYPARAMETERS.fields_by_name[ - "sub_agents" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_agent__pb2._SUBAGENT -) -_QUERYPARAMETERS.fields_by_name[ - "webhook_headers" -].message_type = _QUERYPARAMETERS_WEBHOOKHEADERSENTRY -_QUERYINPUT.fields_by_name[ - "audio_config" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2._INPUTAUDIOCONFIG -) -_QUERYINPUT.fields_by_name["text"].message_type = _TEXTINPUT -_QUERYINPUT.fields_by_name["event"].message_type = _EVENTINPUT -_QUERYINPUT.oneofs_by_name["input"].fields.append( - _QUERYINPUT.fields_by_name["audio_config"] -) -_QUERYINPUT.fields_by_name[ - "audio_config" -].containing_oneof = _QUERYINPUT.oneofs_by_name["input"] -_QUERYINPUT.oneofs_by_name["input"].fields.append(_QUERYINPUT.fields_by_name["text"]) -_QUERYINPUT.fields_by_name["text"].containing_oneof = _QUERYINPUT.oneofs_by_name[ - "input" -] -_QUERYINPUT.oneofs_by_name["input"].fields.append(_QUERYINPUT.fields_by_name["event"]) -_QUERYINPUT.fields_by_name["event"].containing_oneof = _QUERYINPUT.oneofs_by_name[ - "input" -] -_QUERYRESULT.fields_by_name[ - "parameters" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_QUERYRESULT.fields_by_name[ - "fulfillment_messages" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2._INTENT_MESSAGE -) -_QUERYRESULT.fields_by_name[ - "webhook_payload" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_QUERYRESULT.fields_by_name[ - "output_contexts" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2._CONTEXT -) -_QUERYRESULT.fields_by_name[ - "intent" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2._INTENT -) -_QUERYRESULT.fields_by_name[ - "diagnostic_info" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_QUERYRESULT.fields_by_name[ - "sentiment_analysis_result" -].message_type = _SENTIMENTANALYSISRESULT -_QUERYRESULT.fields_by_name["knowledge_answers"].message_type = _KNOWLEDGEANSWERS -_KNOWLEDGEANSWERS_ANSWER.fields_by_name[ - "match_confidence_level" -].enum_type = _KNOWLEDGEANSWERS_ANSWER_MATCHCONFIDENCELEVEL -_KNOWLEDGEANSWERS_ANSWER.containing_type = _KNOWLEDGEANSWERS -_KNOWLEDGEANSWERS_ANSWER_MATCHCONFIDENCELEVEL.containing_type = _KNOWLEDGEANSWERS_ANSWER -_KNOWLEDGEANSWERS.fields_by_name["answers"].message_type = _KNOWLEDGEANSWERS_ANSWER -_STREAMINGDETECTINTENTREQUEST.fields_by_name[ - "query_params" -].message_type = _QUERYPARAMETERS -_STREAMINGDETECTINTENTREQUEST.fields_by_name["query_input"].message_type = _QUERYINPUT -_STREAMINGDETECTINTENTREQUEST.fields_by_name[ - "output_audio_config" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2._OUTPUTAUDIOCONFIG -) -_STREAMINGDETECTINTENTREQUEST.fields_by_name[ - "output_audio_config_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_STREAMINGDETECTINTENTRESPONSE.fields_by_name[ - "recognition_result" -].message_type = _STREAMINGRECOGNITIONRESULT -_STREAMINGDETECTINTENTRESPONSE.fields_by_name[ - "query_result" -].message_type = _QUERYRESULT -_STREAMINGDETECTINTENTRESPONSE.fields_by_name[ - "alternative_query_results" -].message_type = _QUERYRESULT -_STREAMINGDETECTINTENTRESPONSE.fields_by_name[ - "webhook_status" -].message_type = google_dot_rpc_dot_status__pb2._STATUS -_STREAMINGDETECTINTENTRESPONSE.fields_by_name[ - "output_audio_config" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2._OUTPUTAUDIOCONFIG -) -_STREAMINGRECOGNITIONRESULT.fields_by_name[ - "message_type" -].enum_type = _STREAMINGRECOGNITIONRESULT_MESSAGETYPE -_STREAMINGRECOGNITIONRESULT.fields_by_name[ - "speech_word_info" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_audio__config__pb2._SPEECHWORDINFO -) -_STREAMINGRECOGNITIONRESULT.fields_by_name[ - "speech_end_offset" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_STREAMINGRECOGNITIONRESULT_MESSAGETYPE.containing_type = _STREAMINGRECOGNITIONRESULT -_EVENTINPUT.fields_by_name[ - "parameters" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_SENTIMENTANALYSISRESULT.fields_by_name[ - "query_text_sentiment" -].message_type = _SENTIMENT -DESCRIPTOR.message_types_by_name["DetectIntentRequest"] = _DETECTINTENTREQUEST -DESCRIPTOR.message_types_by_name["DetectIntentResponse"] = _DETECTINTENTRESPONSE -DESCRIPTOR.message_types_by_name["QueryParameters"] = _QUERYPARAMETERS -DESCRIPTOR.message_types_by_name["QueryInput"] = _QUERYINPUT -DESCRIPTOR.message_types_by_name["QueryResult"] = _QUERYRESULT -DESCRIPTOR.message_types_by_name["KnowledgeAnswers"] = _KNOWLEDGEANSWERS -DESCRIPTOR.message_types_by_name[ - "StreamingDetectIntentRequest" -] = _STREAMINGDETECTINTENTREQUEST -DESCRIPTOR.message_types_by_name[ - "StreamingDetectIntentResponse" -] = _STREAMINGDETECTINTENTRESPONSE -DESCRIPTOR.message_types_by_name[ - "StreamingRecognitionResult" -] = _STREAMINGRECOGNITIONRESULT -DESCRIPTOR.message_types_by_name["TextInput"] = _TEXTINPUT -DESCRIPTOR.message_types_by_name["EventInput"] = _EVENTINPUT -DESCRIPTOR.message_types_by_name[ - "SentimentAnalysisRequestConfig" -] = _SENTIMENTANALYSISREQUESTCONFIG -DESCRIPTOR.message_types_by_name["SentimentAnalysisResult"] = _SENTIMENTANALYSISRESULT -DESCRIPTOR.message_types_by_name["Sentiment"] = _SENTIMENT -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -DetectIntentRequest = _reflection.GeneratedProtocolMessageType( - "DetectIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _DETECTINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """The request to detect user’s intent. - - Attributes: - session: - Required. The name of the session this query is sent to. - Format: ``projects//agent/sessions/``, - or ``projects//agent/environments//users//sessions/``. If ``Environment - ID`` is not specified, we assume default ‘draft’ environment. - If ``User ID`` is not specified, we are using “-”. It’s up to - the API caller to choose an appropriate ``Session ID`` and - ``User Id``. They can be a random number or some type of user - and session identifiers (preferably hashed). The length of the - ``Session ID`` and ``User ID`` must not exceed 36 characters. - For more information, see the `API interactions guide - `__. - query_params: - The parameters of this query. - query_input: - Required. The input specification. It can be set to: 1. an - audio config which instructs the speech recognizer how to - process the speech audio, 2. a conversational query in the - form of text, or 3. an event that specifies which intent to - trigger. - output_audio_config: - Instructs the speech synthesizer how to generate the output - audio. If this field is not set and agent-level speech - synthesizer is not configured, no output audio is generated. - output_audio_config_mask: - Mask for [output_audio_config][google.cloud.dialogflow.v2beta1 - .DetectIntentRequest.output_audio_config] indicating which - settings in this request-level config should override speech - synthesizer settings defined at agent-level. If unspecified - or empty, [output_audio_config][google.cloud.dialogflow.v2beta - 1.DetectIntentRequest.output_audio_config] replaces the agent- - level config in its entirety. - input_audio: - The natural language speech audio to be processed. This field - should be populated iff ``query_input`` is set to an input - audio config. A single request can contain up to 1 minute of - speech audio data. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.DetectIntentRequest) - }, -) -_sym_db.RegisterMessage(DetectIntentRequest) - -DetectIntentResponse = _reflection.GeneratedProtocolMessageType( - "DetectIntentResponse", - (_message.Message,), - { - "DESCRIPTOR": _DETECTINTENTRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """The message returned from the DetectIntent method. - - Attributes: - response_id: - The unique identifier of the response. It can be used to - locate a response in the training example set or for reporting - issues. - query_result: - The selected results of the conversational query or event - processing. See ``alternative_query_results`` for additional - potential results. - alternative_query_results: - If Knowledge Connectors are enabled, there could be more than - one result returned for a given query or event, and this field - will contain all results except for the top one, which is - captured in query_result. The alternative results are ordered - by decreasing ``QueryResult.intent_detection_confidence``. If - Knowledge Connectors are disabled, this field will be empty - until multiple responses for regular intents are supported, at - which point those additional results will be surfaced here. - webhook_status: - Specifies the status of the webhook request. - output_audio: - The audio data bytes encoded as specified in the request. - Note: The output audio is generated based on the values of - default platform text responses found in the - ``query_result.fulfillment_messages`` field. If multiple - default text responses exist, they will be concatenated when - generating audio. If no default platform text responses exist, - the generated audio content will be empty. In some scenarios, - multiple output audio fields may be present in the response - structure. In these cases, only the top-most-level audio - output has content. - output_audio_config: - The config used by the speech synthesizer to generate the - output audio. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.DetectIntentResponse) - }, -) -_sym_db.RegisterMessage(DetectIntentResponse) - -QueryParameters = _reflection.GeneratedProtocolMessageType( - "QueryParameters", - (_message.Message,), - { - "WebhookHeadersEntry": _reflection.GeneratedProtocolMessageType( - "WebhookHeadersEntry", - (_message.Message,), - { - "DESCRIPTOR": _QUERYPARAMETERS_WEBHOOKHEADERSENTRY, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2" - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.QueryParameters.WebhookHeadersEntry) - }, - ), - "DESCRIPTOR": _QUERYPARAMETERS, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """Represents the parameters of the conversational query. - - Attributes: - time_zone: - The time zone of this conversational query from the `time zone - database `__, e.g., - America/New_York, Europe/Paris. If not provided, the time zone - specified in agent settings is used. - geo_location: - The geo location of this conversational query. - contexts: - The collection of contexts to be activated before this query - is executed. - reset_contexts: - Specifies whether to delete all contexts in the current - session before the new ones are activated. - session_entity_types: - Additional session entity types to replace or extend developer - entity types with. The entity synonyms apply to all languages - and persist for the session of this query. - payload: - This field can be used to pass custom data to your webhook. - Arbitrary JSON objects are supported. If supplied, the value - is used to populate the - ``WebhookRequest.original_detect_intent_request.payload`` - field sent to your webhook. - knowledge_base_names: - KnowledgeBases to get alternative results from. If not set, - the KnowledgeBases enabled in the agent (through UI) will be - used. Format: ``projects//knowledgeBases/``. - sentiment_analysis_request_config: - Configures the type of sentiment analysis to perform. If not - provided, sentiment analysis is not performed. Note: Sentiment - Analysis is only currently available for Enterprise Edition - agents. - sub_agents: - For mega agent query, directly specify which sub agents to - query. If any specified sub agent is not linked to the mega - agent, an error will be returned. If empty, Dialogflow will - decide which sub agents to query. If specified for a non-mega- - agent query, will be silently ignored. - webhook_headers: - This field can be used to pass HTTP headers for a webhook - call. These headers will be sent to webhook alone with the - headers that have been configured through Dialogflow web - console. The headers defined within this field will overwrite - the headers configured through Dialogflow console if there is - a conflict. Header names are case-insensitive. Google’s - specified headers are not allowed. Including: “Host”, - “Content-Length”, “Connection”, “From”, “User-Agent”, “Accept- - Encoding”, “If-Modified-Since”, “If-None-Match”, “X-Forwarded- - For”, etc. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.QueryParameters) - }, -) -_sym_db.RegisterMessage(QueryParameters) -_sym_db.RegisterMessage(QueryParameters.WebhookHeadersEntry) - -QueryInput = _reflection.GeneratedProtocolMessageType( - "QueryInput", - (_message.Message,), - { - "DESCRIPTOR": _QUERYINPUT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """Represents the query input. It can contain either: 1. An audio config - which instructs the speech recognizer how to process the speech - audio. 2. A conversational query in the form of text. 3. An event - that specifies which intent to trigger. - - Attributes: - input: - Required. The input specification. - audio_config: - Instructs the speech recognizer how to process the speech - audio. - text: - The natural language text to be processed. - event: - The event to be processed. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.QueryInput) - }, -) -_sym_db.RegisterMessage(QueryInput) - -QueryResult = _reflection.GeneratedProtocolMessageType( - "QueryResult", - (_message.Message,), - { - "DESCRIPTOR": _QUERYRESULT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """Represents the result of conversational query or event processing. - - Attributes: - query_text: - The original conversational query text: - If natural - language text was provided as input, ``query_text`` - contains a copy of the input. - If natural language speech - audio was provided as input, ``query_text`` contains the - speech recognition result. If speech recognizer produced - multiple alternatives, a particular one is picked. - If - automatic spell correction is enabled, ``query_text`` will - contain the corrected user input. - language_code: - The language that was triggered during intent detection. See - `Language Support `__ for a list of the currently supported - language codes. - speech_recognition_confidence: - The Speech recognition confidence between 0.0 and 1.0. A - higher number indicates an estimated greater likelihood that - the recognized words are correct. The default of 0.0 is a - sentinel value indicating that confidence was not set. This - field is not guaranteed to be accurate or set. In particular - this field isn’t set for StreamingDetectIntent since the - streaming endpoint has separate confidence estimates per - portion of the audio in StreamingRecognitionResult. - action: - The action name from the matched intent. - parameters: - The collection of extracted parameters. 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: string or number, depending - on parameter value type - MapValue value: - If - parameter’s entity type is a composite entity: map from - composite entity property names to property values - Else: - parameter value - all_required_params_present: - This field is set to: - ``false`` if the matched intent has - required parameters and not all of the required parameter - values have been collected. - ``true`` if all required - parameter values have been collected, or if the matched - intent doesn’t contain any required parameters. - fulfillment_text: - The text to be pronounced to the user or shown on the screen. - Note: This is a legacy field, ``fulfillment_messages`` should - be preferred. - fulfillment_messages: - The collection of rich messages to present to the user. - webhook_source: - If the query was fulfilled by a webhook call, this field is - set to the value of the ``source`` field returned in the - webhook response. - webhook_payload: - If the query was fulfilled by a webhook call, this field is - set to the value of the ``payload`` field returned in the - webhook response. - output_contexts: - The collection of output contexts. If applicable, - ``output_contexts.parameters`` contains entries with name - ``.original`` containing the original - parameter values before the query. - intent: - The intent that matched the conversational query. Some, not - all fields are filled in this message, including but not - limited to: ``name``, ``display_name``, ``end_interaction`` - and ``is_fallback``. - intent_detection_confidence: - The intent detection confidence. Values range from 0.0 - (completely uncertain) to 1.0 (completely certain). This value - is for informational purpose only and is only used to help - match the best intent within the classification threshold. - This value may change for the same end-user expression at any - time due to a model retraining or change in implementation. If - there are ``multiple knowledge_answers`` messages, this value - is set to the greatest ``knowledgeAnswers.match_confidence`` - value in the list. - diagnostic_info: - Free-form diagnostic information for the associated detect - intent request. The fields of this data can change without - notice, so you should not write code that depends on its - structure. The data may contain: - webhook call latency - - webhook errors - sentiment_analysis_result: - The sentiment analysis result, which depends on the - ``sentiment_analysis_request_config`` specified in the - request. - knowledge_answers: - The result from Knowledge Connector (if any), ordered by - decreasing ``KnowledgeAnswers.match_confidence``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.QueryResult) - }, -) -_sym_db.RegisterMessage(QueryResult) - -KnowledgeAnswers = _reflection.GeneratedProtocolMessageType( - "KnowledgeAnswers", - (_message.Message,), - { - "Answer": _reflection.GeneratedProtocolMessageType( - "Answer", - (_message.Message,), - { - "DESCRIPTOR": _KNOWLEDGEANSWERS_ANSWER, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """An answer from Knowledge Connector. - - Attributes: - source: - Indicates which Knowledge Document this answer was extracted - from. Format: ``projects//knowledgeBases//documents/``. - faq_question: - The corresponding FAQ question if the answer was extracted - from a FAQ Document, empty otherwise. - answer: - The piece of text from the ``source`` knowledge base document - that answers this conversational query. - match_confidence_level: - The system’s confidence level that this knowledge answer is a - good match for this conversational query. NOTE: The confidence - level for a given ```` pair may change without - notice, as it depends on models that are constantly being - improved. However, it will change less frequently than the - confidence score below, and should be preferred for - referencing the quality of an answer. - match_confidence: - The system’s confidence score that this Knowledge answer is a - good match for this conversational query. The range is from - 0.0 (completely uncertain) to 1.0 (completely certain). Note: - The confidence score is likely to vary somewhat (possibly even - for identical requests), as the underlying model is under - constant improvement. It may be deprecated in the future. We - recommend using ``match_confidence_level`` which should be - generally more stable. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer) - }, - ), - "DESCRIPTOR": _KNOWLEDGEANSWERS, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """Represents the result of querying a Knowledge base. - - Attributes: - answers: - A list of answers from Knowledge Connector. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.KnowledgeAnswers) - }, -) -_sym_db.RegisterMessage(KnowledgeAnswers) -_sym_db.RegisterMessage(KnowledgeAnswers.Answer) - -StreamingDetectIntentRequest = _reflection.GeneratedProtocolMessageType( - "StreamingDetectIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _STREAMINGDETECTINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """The top-level message sent by the client to the [Sessions.StreamingDet - ectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectInt - ent] method. Multiple request messages should be sent in order: 1. - The first message must contain [session][google.cloud.dialogflow.v2 - beta1.StreamingDetectIntentRequest.session], [query_input][google.c - loud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] - plus optionally [query_params][google.cloud.dialogflow.v2beta1.Stre - amingDetectIntentRequest.query_params]. If the client wants to - receive an audio response, it should also contain [output_audio_ - config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.o - utput_audio_config]. The message must not contain [input_audio][ - google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_aud - io]. 2. If [query_input][google.cloud.dialogflow.v2beta1.StreamingD - etectIntentRequest.query_input] was set to [query_input.audio_co - nfig][google.cloud.dialogflow.v2beta1.InputAudioConfig], all - subsequent messages must contain [input_audio][google.cloud.dialogf - low.v2beta1.StreamingDetectIntentRequest.input_audio] to continue - with Speech recognition. If you decide to rather detect an intent - from text input after you already started Speech recognition, - please send a message with - [query_input.text][google.cloud.dialogflow.v2beta1.QueryInput.text]. - However, note that: - Dialogflow will bill you for the audio - duration so far. - Dialogflow discards all Speech recognition - results in favor of the input text. - Dialogflow will use - the language code from the first message. After you sent all input, - you must half-close or abort the request stream. - - Attributes: - session: - Required. The name of the session the query is sent to. Format - of the session name: ``projects//agent/sessions/``, or ``projects//agent/environments//users//sessions/``. If ``Environment ID`` is not - specified, we assume default ‘draft’ environment. If ``User - ID`` is not specified, we are using “-”. It’s up to the API - caller to choose an appropriate ``Session ID`` and ``User - Id``. They can be a random number or some type of user and - session identifiers (preferably hashed). The length of the - ``Session ID`` and ``User ID`` must not exceed 36 characters. - For more information, see the `API interactions guide - `__. - query_params: - The parameters of this query. - query_input: - Required. The input specification. It can be set to: 1. an - audio config which instructs the speech recognizer how to - process the speech audio, 2. a conversational query in the - form of text, or 3. an event that specifies which intent to - trigger. - single_utterance: - DEPRECATED. Please use [InputAudioConfig.single_utterance][goo - gle.cloud.dialogflow.v2beta1.InputAudioConfig.single_utterance - ] instead. If ``false`` (default), recognition does not cease - until the client closes the stream. If ``true``, the - recognizer will detect a single spoken utterance in input - audio. Recognition ceases when it detects the audio’s voice - has stopped or paused. In this case, once a detected intent is - received, the client should close the stream and start a new - request with a new stream as needed. This setting is ignored - when ``query_input`` is a piece of text or an event. - output_audio_config: - Instructs the speech synthesizer how to generate the output - audio. If this field is not set and agent-level speech - synthesizer is not configured, no output audio is generated. - output_audio_config_mask: - Mask for [output_audio_config][google.cloud.dialogflow.v2beta1 - .StreamingDetectIntentRequest.output_audio_config] indicating - which settings in this request-level config should override - speech synthesizer settings defined at agent-level. If - unspecified or empty, [output_audio_config][google.cloud.dialo - gflow.v2beta1.StreamingDetectIntentRequest.output_audio_config - ] replaces the agent-level config in its entirety. - input_audio: - The input audio content to be recognized. Must be sent if - ``query_input`` was set to a streaming input audio config. The - complete audio over all streaming messages must not exceed 1 - minute. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest) - }, -) -_sym_db.RegisterMessage(StreamingDetectIntentRequest) - -StreamingDetectIntentResponse = _reflection.GeneratedProtocolMessageType( - "StreamingDetectIntentResponse", - (_message.Message,), - { - "DESCRIPTOR": _STREAMINGDETECTINTENTRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """The top-level message returned from the ``StreamingDetectIntent`` - method. Multiple response messages can be returned in order: 1. If - the input was set to streaming audio, the first one or more - messages contain ``recognition_result``. Each ``recognition_result`` - represents a more complete transcript of what the user said. The last - ``recognition_result`` has ``is_final`` set to ``true``. 2. The next - message contains ``response_id``, ``query_result``, - ``alternative_query_results`` and optionally ``webhook_status`` if a - WebHook was called. 3. If ``output_audio_config`` was specified in - the request or agent-level speech synthesizer is configured, all - subsequent messages contain ``output_audio`` and - ``output_audio_config``. - - Attributes: - response_id: - The unique identifier of the response. It can be used to - locate a response in the training example set or for reporting - issues. - recognition_result: - The result of speech recognition. - query_result: - The selected results of the conversational query or event - processing. See ``alternative_query_results`` for additional - potential results. - alternative_query_results: - If Knowledge Connectors are enabled, there could be more than - one result returned for a given query or event, and this field - will contain all results except for the top one, which is - captured in query_result. The alternative results are ordered - by decreasing ``QueryResult.intent_detection_confidence``. If - Knowledge Connectors are disabled, this field will be empty - until multiple responses for regular intents are supported, at - which point those additional results will be surfaced here. - webhook_status: - Specifies the status of the webhook request. - output_audio: - The audio data bytes encoded as specified in the request. - Note: The output audio is generated based on the values of - default platform text responses found in the - ``query_result.fulfillment_messages`` field. If multiple - default text responses exist, they will be concatenated when - generating audio. If no default platform text responses exist, - the generated audio content will be empty. In some scenarios, - multiple output audio fields may be present in the response - structure. In these cases, only the top-most-level audio - output has content. - output_audio_config: - The config used by the speech synthesizer to generate the - output audio. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse) - }, -) -_sym_db.RegisterMessage(StreamingDetectIntentResponse) - -StreamingRecognitionResult = _reflection.GeneratedProtocolMessageType( - "StreamingRecognitionResult", - (_message.Message,), - { - "DESCRIPTOR": _STREAMINGRECOGNITIONRESULT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """Contains a speech recognition result corresponding to a portion of the - audio that is currently being processed or an indication that this is - the end of the single requested utterance. Example: 1. transcript: - “tube” 2. transcript: “to be a” 3. transcript: “to be” 4. - transcript: “to be or not to be” is_final: true 5. transcript: " - that’s" 6. transcript: " that is" 7. message_type: - ``END_OF_SINGLE_UTTERANCE`` 8. transcript: " that is the question" - is_final: true Only two of the responses contain final results (#4 - and #8 indicated by ``is_final: true``). Concatenating these generates - the full transcript: “to be or not to be that is the question”. In - each response we populate: - for ``TRANSCRIPT``: ``transcript`` and - possibly ``is_final``. - for ``END_OF_SINGLE_UTTERANCE``: only - ``message_type``. - - Attributes: - message_type: - Type of the result message. - transcript: - Transcript text representing the words that the user spoke. - Populated if and only if ``message_type`` = ``TRANSCRIPT``. - is_final: - If ``false``, the ``StreamingRecognitionResult`` represents an - interim result that may change. If ``true``, the recognizer - will not return any further hypotheses about this piece of the - audio. May only be populated for ``message_type`` = - ``TRANSCRIPT``. - confidence: - The Speech confidence between 0.0 and 1.0 for the current - portion of audio. A higher number indicates an estimated - greater likelihood that the recognized words are correct. The - default of 0.0 is a sentinel value indicating that confidence - was not set. This field is typically only provided if - ``is_final`` is true and you should not rely on it being - accurate or even set. - stability: - An estimate of the likelihood that the speech recognizer will - not change its guess about this interim recognition result: - - If the value is unspecified or 0.0, Dialogflow didn’t compute - the stability. In particular, Dialogflow will only provide - stability for ``TRANSCRIPT`` results with ``is_final = - false``. - Otherwise, the value is in (0.0, 1.0] where 0.0 - means completely unstable and 1.0 means completely stable. - speech_word_info: - Word-specific information for the words recognized by Speech - in [transcript][google.cloud.dialogflow.v2beta1.StreamingRecog - nitionResult.transcript]. Populated if and only if - ``message_type`` = ``TRANSCRIPT`` and - [InputAudioConfig.enable_word_info] is set. - speech_end_offset: - Time offset of the end of this Speech recognition result - relative to the beginning of the audio. Only populated for - ``message_type`` = ``TRANSCRIPT``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.StreamingRecognitionResult) - }, -) -_sym_db.RegisterMessage(StreamingRecognitionResult) - -TextInput = _reflection.GeneratedProtocolMessageType( - "TextInput", - (_message.Message,), - { - "DESCRIPTOR": _TEXTINPUT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """Represents the natural language text to be processed. - - Attributes: - text: - Required. The UTF-8 encoded natural language text to be - processed. Text length must not exceed 256 characters. - language_code: - Required. The language of this conversational query. See - `Language Support `__ for a list of the currently supported - language codes. Note that queries in the same session do not - necessarily need to specify the same language. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.TextInput) - }, -) -_sym_db.RegisterMessage(TextInput) - -EventInput = _reflection.GeneratedProtocolMessageType( - "EventInput", - (_message.Message,), - { - "DESCRIPTOR": _EVENTINPUT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """Events allow for matching intents by event name instead of the natural - language input. For instance, input ```` can trigger a personalized welcome - response. The parameter ``name`` may be used by the agent in the - response: ``"Hello #welcome_event.name! What can I do for you - today?"``. - - Attributes: - name: - Required. The unique identifier of the event. - parameters: - The collection of parameters associated with the event. - 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: string or number, depending - on parameter value type - MapValue value: - If - parameter’s entity type is a composite entity: map from - composite entity property names to property values - Else: - parameter value - language_code: - Required. The language of this query. See `Language Support `__ - for a list of the currently supported language codes. Note - that queries in the same session do not necessarily need to - specify the same language. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.EventInput) - }, -) -_sym_db.RegisterMessage(EventInput) - -SentimentAnalysisRequestConfig = _reflection.GeneratedProtocolMessageType( - "SentimentAnalysisRequestConfig", - (_message.Message,), - { - "DESCRIPTOR": _SENTIMENTANALYSISREQUESTCONFIG, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """Configures the types of sentiment analysis to perform. - - Attributes: - analyze_query_text_sentiment: - Instructs the service to perform sentiment analysis on - ``query_text``. If not provided, sentiment analysis is not - performed on ``query_text``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig) - }, -) -_sym_db.RegisterMessage(SentimentAnalysisRequestConfig) - -SentimentAnalysisResult = _reflection.GeneratedProtocolMessageType( - "SentimentAnalysisResult", - (_message.Message,), - { - "DESCRIPTOR": _SENTIMENTANALYSISRESULT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """The result of sentiment analysis. Sentiment analysis inspects user - input and identifies the prevailing subjective opinion, especially to - determine a user’s attitude as positive, negative, or neutral. For [Pa - rticipants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participant - s.AnalyzeContent], it needs to be configured in [DetectIntentRequest.q - uery_params][google.cloud.dialogflow.v2beta1.DetectIntentRequest.query - _params]. For [Participants.StreamingAnalyzeContent][google.cloud.dial - ogflow.v2beta1.Participants.StreamingAnalyzeContent], it needs to be - configured in [StreamingDetectIntentRequest.query_params][google.cloud - .dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. And - for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Part - icipants.AnalyzeContent] and [Participants.StreamingAnalyzeContent][go - ogle.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent], - it needs to be configured in [ConversationProfile.human_agent_assistan - t_config][google.cloud.dialogflow.v2beta1.ConversationProfile.human_ag - ent_assistant_config] - - Attributes: - query_text_sentiment: - The sentiment analysis result for ``query_text``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.SentimentAnalysisResult) - }, -) -_sym_db.RegisterMessage(SentimentAnalysisResult) - -Sentiment = _reflection.GeneratedProtocolMessageType( - "Sentiment", - (_message.Message,), - { - "DESCRIPTOR": _SENTIMENT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.session_pb2", - "__doc__": """The sentiment, such as positive/negative feeling or association, for a - unit of analysis, such as the query text. - - Attributes: - score: - Sentiment score between -1.0 (negative sentiment) and 1.0 - (positive sentiment). - magnitude: - A non-negative number in the [0, +inf) range, which represents - the absolute magnitude of sentiment, regardless of score - (positive or negative). - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Sentiment) - }, -) -_sym_db.RegisterMessage(Sentiment) - - -DESCRIPTOR._options = None -_DETECTINTENTREQUEST.fields_by_name["session"]._options = None -_DETECTINTENTREQUEST.fields_by_name["query_input"]._options = None -_QUERYPARAMETERS_WEBHOOKHEADERSENTRY._options = None -_KNOWLEDGEANSWERS_ANSWER.fields_by_name["source"]._options = None -_STREAMINGDETECTINTENTREQUEST.fields_by_name["session"]._options = None -_STREAMINGDETECTINTENTREQUEST.fields_by_name["query_input"]._options = None - -_SESSIONS = _descriptor.ServiceDescriptor( - name="Sessions", - full_name="google.cloud.dialogflow.v2beta1.Sessions", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031dialogflow.googleapis.com\322AYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow", - create_key=_descriptor._internal_create_key, - serialized_start=5032, - serialized_end=5813, - methods=[ - _descriptor.MethodDescriptor( - name="DetectIntent", - full_name="google.cloud.dialogflow.v2beta1.Sessions.DetectIntent", - index=0, - containing_service=None, - input_type=_DETECTINTENTREQUEST, - output_type=_DETECTINTENTRESPONSE, - serialized_options=b'\202\323\344\223\002\314\002";/v2beta1/{session=projects/*/agent/sessions/*}:detectIntent:\001*ZW"R/v2beta1/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent:\001*ZL"G/v2beta1/{session=projects/*/locations/*/agent/sessions/*}:detectIntent:\001*Zc"^/v2beta1/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent:\001*\332A\023session,query_input', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="StreamingDetectIntent", - full_name="google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent", - index=1, - containing_service=None, - input_type=_STREAMINGDETECTINTENTREQUEST, - output_type=_STREAMINGDETECTINTENTRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_SESSIONS) - -DESCRIPTOR.services_by_name["Sessions"] = _SESSIONS - -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/session_pb2_grpc.py b/dialogflow_v2beta1/proto/session_pb2_grpc.py deleted file mode 100644 index 4a860f14d..000000000 --- a/dialogflow_v2beta1/proto/session_pb2_grpc.py +++ /dev/null @@ -1,141 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from dialogflow_v2beta1.proto import ( - session_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2, -) - - -class SessionsStub(object): - """A service used for session interactions. - - For more information, see the [API interactions - guide](https://cloud.google.com/dialogflow/docs/api-overview). - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.DetectIntent = channel.unary_unary( - "/google.cloud.dialogflow.v2beta1.Sessions/DetectIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.DetectIntentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.DetectIntentResponse.FromString, - ) - self.StreamingDetectIntent = channel.stream_stream( - "/google.cloud.dialogflow.v2beta1.Sessions/StreamingDetectIntent", - request_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.StreamingDetectIntentRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.StreamingDetectIntentResponse.FromString, - ) - - -class SessionsServicer(object): - """A service used for session interactions. - - For more information, see the [API interactions - guide](https://cloud.google.com/dialogflow/docs/api-overview). - """ - - def DetectIntent(self, request, context): - """Processes a natural language query and returns structured, actionable data - as a result. This method is not idempotent, because it may cause contexts - and session entity types to be updated, which in turn might affect - results of future queries. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def StreamingDetectIntent(self, request_iterator, context): - """Processes a natural language query in audio format in a streaming fashion - and returns structured, actionable data as a result. This method is only - available via the gRPC API (not REST). - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_SessionsServicer_to_server(servicer, server): - rpc_method_handlers = { - "DetectIntent": grpc.unary_unary_rpc_method_handler( - servicer.DetectIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.DetectIntentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.DetectIntentResponse.SerializeToString, - ), - "StreamingDetectIntent": grpc.stream_stream_rpc_method_handler( - servicer.StreamingDetectIntent, - request_deserializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.StreamingDetectIntentRequest.FromString, - response_serializer=google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.StreamingDetectIntentResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.dialogflow.v2beta1.Sessions", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Sessions(object): - """A service used for session interactions. - - For more information, see the [API interactions - guide](https://cloud.google.com/dialogflow/docs/api-overview). - """ - - @staticmethod - def DetectIntent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.dialogflow.v2beta1.Sessions/DetectIntent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.DetectIntentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.DetectIntentResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def StreamingDetectIntent( - request_iterator, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.stream_stream( - request_iterator, - target, - "/google.cloud.dialogflow.v2beta1.Sessions/StreamingDetectIntent", - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.StreamingDetectIntentRequest.SerializeToString, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.StreamingDetectIntentResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/dialogflow_v2beta1/proto/validation_result_pb2.py b/dialogflow_v2beta1/proto/validation_result_pb2.py deleted file mode 100644 index f594b5095..000000000 --- a/dialogflow_v2beta1/proto/validation_result_pb2.py +++ /dev/null @@ -1,260 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/validation_result.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/validation_result.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\025ValidationResultProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n=google/cloud/dialogflow_v2beta1/proto/validation_result.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x1cgoogle/api/annotations.proto"\xdc\x01\n\x0fValidationError\x12K\n\x08severity\x18\x01 \x01(\x0e\x32\x39.google.cloud.dialogflow.v2beta1.ValidationError.Severity\x12\x0f\n\x07\x65ntries\x18\x03 \x03(\t\x12\x15\n\rerror_message\x18\x04 \x01(\t"T\n\x08Severity\x12\x18\n\x14SEVERITY_UNSPECIFIED\x10\x00\x12\x08\n\x04INFO\x10\x01\x12\x0b\n\x07WARNING\x10\x02\x12\t\n\x05\x45RROR\x10\x03\x12\x0c\n\x08\x43RITICAL\x10\x04"_\n\x10ValidationResult\x12K\n\x11validation_errors\x18\x01 \x03(\x0b\x32\x30.google.cloud.dialogflow.v2beta1.ValidationErrorB\xb3\x01\n#com.google.cloud.dialogflow.v2beta1B\x15ValidationResultProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR], -) - - -_VALIDATIONERROR_SEVERITY = _descriptor.EnumDescriptor( - name="Severity", - full_name="google.cloud.dialogflow.v2beta1.ValidationError.Severity", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="SEVERITY_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INFO", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WARNING", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ERROR", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CRITICAL", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=265, - serialized_end=349, -) -_sym_db.RegisterEnumDescriptor(_VALIDATIONERROR_SEVERITY) - - -_VALIDATIONERROR = _descriptor.Descriptor( - name="ValidationError", - full_name="google.cloud.dialogflow.v2beta1.ValidationError", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="severity", - full_name="google.cloud.dialogflow.v2beta1.ValidationError.severity", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entries", - full_name="google.cloud.dialogflow.v2beta1.ValidationError.entries", - index=1, - number=3, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="error_message", - full_name="google.cloud.dialogflow.v2beta1.ValidationError.error_message", - index=2, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_VALIDATIONERROR_SEVERITY], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=129, - serialized_end=349, -) - - -_VALIDATIONRESULT = _descriptor.Descriptor( - name="ValidationResult", - full_name="google.cloud.dialogflow.v2beta1.ValidationResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="validation_errors", - full_name="google.cloud.dialogflow.v2beta1.ValidationResult.validation_errors", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ) - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=351, - serialized_end=446, -) - -_VALIDATIONERROR.fields_by_name["severity"].enum_type = _VALIDATIONERROR_SEVERITY -_VALIDATIONERROR_SEVERITY.containing_type = _VALIDATIONERROR -_VALIDATIONRESULT.fields_by_name["validation_errors"].message_type = _VALIDATIONERROR -DESCRIPTOR.message_types_by_name["ValidationError"] = _VALIDATIONERROR -DESCRIPTOR.message_types_by_name["ValidationResult"] = _VALIDATIONRESULT -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -ValidationError = _reflection.GeneratedProtocolMessageType( - "ValidationError", - (_message.Message,), - { - "DESCRIPTOR": _VALIDATIONERROR, - "__module__": "google.cloud.dialogflow_v2beta1.proto.validation_result_pb2", - "__doc__": """Represents a single validation error. - - Attributes: - severity: - The severity of the error. - entries: - The names of the entries that the error is associated with. - Format: - “projects//agent”, if the error is associated with - the entire agent. - “projects//agent/intents/”, if the error - is associated with certain intents. - - “projects//agent/intents//trainingPhrases/”, if the error is - associated with certain intent training phrases. - - “projects//agent/intents//parameters/”, if the error is - associated with certain intent parameters. - - “projects//agent/entities/”, if the error is associated with - certain entities. - error_message: - The detailed error messsage. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ValidationError) - }, -) -_sym_db.RegisterMessage(ValidationError) - -ValidationResult = _reflection.GeneratedProtocolMessageType( - "ValidationResult", - (_message.Message,), - { - "DESCRIPTOR": _VALIDATIONRESULT, - "__module__": "google.cloud.dialogflow_v2beta1.proto.validation_result_pb2", - "__doc__": """Represents the output of agent validation. - - Attributes: - validation_errors: - Contains all validation errors. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.ValidationResult) - }, -) -_sym_db.RegisterMessage(ValidationResult) - - -DESCRIPTOR._options = None -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/validation_result_pb2_grpc.py b/dialogflow_v2beta1/proto/validation_result_pb2_grpc.py deleted file mode 100644 index 8a9393943..000000000 --- a/dialogflow_v2beta1/proto/validation_result_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/dialogflow_v2beta1/proto/webhook_pb2.py b/dialogflow_v2beta1/proto/webhook_pb2.py deleted file mode 100644 index 137eaa71a..000000000 --- a/dialogflow_v2beta1/proto/webhook_pb2.py +++ /dev/null @@ -1,612 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/dialogflow_v2beta1/proto/webhook.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from dialogflow_v2beta1.proto import ( - context_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2, -) -from dialogflow_v2beta1.proto import ( - intent_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2, -) -from dialogflow_v2beta1.proto import ( - session_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2, -) -from dialogflow_v2beta1.proto import ( - session_entity_type_pb2 as google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2, -) -from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/dialogflow_v2beta1/proto/webhook.proto", - package="google.cloud.dialogflow.v2beta1", - syntax="proto3", - serialized_options=b"\n#com.google.cloud.dialogflow.v2beta1B\014WebhookProtoP\001ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\370\001\001\242\002\002DF\252\002\037Google.Cloud.Dialogflow.V2beta1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n3google/cloud/dialogflow_v2beta1/proto/webhook.proto\x12\x1fgoogle.cloud.dialogflow.v2beta1\x1a\x33google/cloud/dialogflow_v2beta1/proto/context.proto\x1a\x32google/cloud/dialogflow_v2beta1/proto/intent.proto\x1a\x33google/cloud/dialogflow_v2beta1/proto/session.proto\x1a?google/cloud/dialogflow_v2beta1/proto/session_entity_type.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1cgoogle/api/annotations.proto"\xb1\x02\n\x0eWebhookRequest\x12\x0f\n\x07session\x18\x04 \x01(\t\x12\x13\n\x0bresponse_id\x18\x01 \x01(\t\x12\x42\n\x0cquery_result\x18\x02 \x01(\x0b\x32,.google.cloud.dialogflow.v2beta1.QueryResult\x12O\n\x19\x61lternative_query_results\x18\x05 \x03(\x0b\x32,.google.cloud.dialogflow.v2beta1.QueryResult\x12\x64\n\x1eoriginal_detect_intent_request\x18\x03 \x01(\x0b\x32<.google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest"\xad\x03\n\x0fWebhookResponse\x12\x18\n\x10\x66ulfillment_text\x18\x01 \x01(\t\x12M\n\x14\x66ulfillment_messages\x18\x02 \x03(\x0b\x32/.google.cloud.dialogflow.v2beta1.Intent.Message\x12\x0e\n\x06source\x18\x03 \x01(\t\x12(\n\x07payload\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x41\n\x0foutput_contexts\x18\x05 \x03(\x0b\x32(.google.cloud.dialogflow.v2beta1.Context\x12I\n\x14\x66ollowup_event_input\x18\x06 \x01(\x0b\x32+.google.cloud.dialogflow.v2beta1.EventInput\x12\x17\n\x0f\x65nd_interaction\x18\x08 \x01(\x08\x12P\n\x14session_entity_types\x18\n \x03(\x0b\x32\x32.google.cloud.dialogflow.v2beta1.SessionEntityType"h\n\x1bOriginalDetectIntentRequest\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12(\n\x07payload\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructB\xaa\x01\n#com.google.cloud.dialogflow.v2beta1B\x0cWebhookProtoP\x01ZIgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow\xf8\x01\x01\xa2\x02\x02\x44\x46\xaa\x02\x1fGoogle.Cloud.Dialogflow.V2beta1b\x06proto3', - dependencies=[ - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2.DESCRIPTOR, - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2.DESCRIPTOR, - google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - - -_WEBHOOKREQUEST = _descriptor.Descriptor( - name="WebhookRequest", - full_name="google.cloud.dialogflow.v2beta1.WebhookRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="session", - full_name="google.cloud.dialogflow.v2beta1.WebhookRequest.session", - index=0, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="response_id", - full_name="google.cloud.dialogflow.v2beta1.WebhookRequest.response_id", - index=1, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_result", - full_name="google.cloud.dialogflow.v2beta1.WebhookRequest.query_result", - index=2, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="alternative_query_results", - full_name="google.cloud.dialogflow.v2beta1.WebhookRequest.alternative_query_results", - index=3, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="original_detect_intent_request", - full_name="google.cloud.dialogflow.v2beta1.WebhookRequest.original_detect_intent_request", - index=4, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=372, - serialized_end=677, -) - - -_WEBHOOKRESPONSE = _descriptor.Descriptor( - name="WebhookResponse", - full_name="google.cloud.dialogflow.v2beta1.WebhookResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="fulfillment_text", - full_name="google.cloud.dialogflow.v2beta1.WebhookResponse.fulfillment_text", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="fulfillment_messages", - full_name="google.cloud.dialogflow.v2beta1.WebhookResponse.fulfillment_messages", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="source", - full_name="google.cloud.dialogflow.v2beta1.WebhookResponse.source", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="payload", - full_name="google.cloud.dialogflow.v2beta1.WebhookResponse.payload", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="output_contexts", - full_name="google.cloud.dialogflow.v2beta1.WebhookResponse.output_contexts", - index=4, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="followup_event_input", - full_name="google.cloud.dialogflow.v2beta1.WebhookResponse.followup_event_input", - index=5, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_interaction", - full_name="google.cloud.dialogflow.v2beta1.WebhookResponse.end_interaction", - index=6, - number=8, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="session_entity_types", - full_name="google.cloud.dialogflow.v2beta1.WebhookResponse.session_entity_types", - index=7, - number=10, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=680, - serialized_end=1109, -) - - -_ORIGINALDETECTINTENTREQUEST = _descriptor.Descriptor( - name="OriginalDetectIntentRequest", - full_name="google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="source", - full_name="google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.source", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="version", - full_name="google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.version", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="payload", - full_name="google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.payload", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1111, - serialized_end=1215, -) - -_WEBHOOKREQUEST.fields_by_name[ - "query_result" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2._QUERYRESULT -) -_WEBHOOKREQUEST.fields_by_name[ - "alternative_query_results" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2._QUERYRESULT -) -_WEBHOOKREQUEST.fields_by_name[ - "original_detect_intent_request" -].message_type = _ORIGINALDETECTINTENTREQUEST -_WEBHOOKRESPONSE.fields_by_name[ - "fulfillment_messages" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_intent__pb2._INTENT_MESSAGE -) -_WEBHOOKRESPONSE.fields_by_name[ - "payload" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_WEBHOOKRESPONSE.fields_by_name[ - "output_contexts" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_context__pb2._CONTEXT -) -_WEBHOOKRESPONSE.fields_by_name[ - "followup_event_input" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__pb2._EVENTINPUT -) -_WEBHOOKRESPONSE.fields_by_name[ - "session_entity_types" -].message_type = ( - google_dot_cloud_dot_dialogflow__v2beta1_dot_proto_dot_session__entity__type__pb2._SESSIONENTITYTYPE -) -_ORIGINALDETECTINTENTREQUEST.fields_by_name[ - "payload" -].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -DESCRIPTOR.message_types_by_name["WebhookRequest"] = _WEBHOOKREQUEST -DESCRIPTOR.message_types_by_name["WebhookResponse"] = _WEBHOOKRESPONSE -DESCRIPTOR.message_types_by_name[ - "OriginalDetectIntentRequest" -] = _ORIGINALDETECTINTENTREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -WebhookRequest = _reflection.GeneratedProtocolMessageType( - "WebhookRequest", - (_message.Message,), - { - "DESCRIPTOR": _WEBHOOKREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.webhook_pb2", - "__doc__": """The request message for a webhook call. - - Attributes: - session: - The unique identifier of detectIntent request session. Can be - used to identify end-user inside webhook implementation. - Format: ``projects//agent/sessions/``, - or ``projects//agent/environments//users//sessions/``. - response_id: - The unique identifier of the response. Contains the same value - as ``[Streaming]DetectIntentResponse.response_id``. - query_result: - The result of the conversational query or event processing. - Contains the same value as - ``[Streaming]DetectIntentResponse.query_result``. - alternative_query_results: - Alternative query results from KnowledgeService. - original_detect_intent_request: - Optional. The contents of the original request that was passed - to ``[Streaming]DetectIntent`` call. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.WebhookRequest) - }, -) -_sym_db.RegisterMessage(WebhookRequest) - -WebhookResponse = _reflection.GeneratedProtocolMessageType( - "WebhookResponse", - (_message.Message,), - { - "DESCRIPTOR": _WEBHOOKRESPONSE, - "__module__": "google.cloud.dialogflow_v2beta1.proto.webhook_pb2", - "__doc__": """The response message for a webhook call. This response is validated - by the Dialogflow server. If validation fails, an error will be - returned in the [QueryResult.diagnostic_info][google.cloud.dialogflow. - v2beta1.QueryResult.diagnostic_info] field. Setting JSON fields to an - empty value with the wrong type is a common error. To avoid this - error: - Use ``""`` for empty strings - Use ``{}`` or ``null`` for - empty objects - Use ``[]`` or ``null`` for empty arrays For more - information, see the `Protocol Buffers Language Guide - `__. - - Attributes: - fulfillment_text: - Optional. The text response message intended for the end-user. - It is recommended to use ``fulfillment_messages.text.text[0]`` - instead. When provided, Dialogflow uses this field to populate - [QueryResult.fulfillment_text][google.cloud.dialogflow.v2beta1 - .QueryResult.fulfillment_text] sent to the integration or API - caller. - fulfillment_messages: - Optional. The rich response messages intended for the end- - user. When provided, Dialogflow uses this field to populate [Q - ueryResult.fulfillment_messages][google.cloud.dialogflow.v2bet - a1.QueryResult.fulfillment_messages] sent to the integration - or API caller. - source: - Optional. A custom field used to identify the webhook source. - Arbitrary strings are supported. When provided, Dialogflow - uses this field to populate [QueryResult.webhook_source][googl - e.cloud.dialogflow.v2beta1.QueryResult.webhook_source] sent to - the integration or API caller. - payload: - Optional. This field can be used to pass custom data from your - webhook to the integration or API caller. Arbitrary JSON - objects are supported. When provided, Dialogflow uses this - field to populate [QueryResult.webhook_payload][google.cloud.d - ialogflow.v2beta1.QueryResult.webhook_payload] sent to the - integration or API caller. This field is also used by the - `Google Assistant integration - `__ - for rich response messages. See the format definition at - `Google Assistant Dialogflow webhook format `__ - output_contexts: - Optional. The collection of output contexts that will - overwrite currently active contexts for the session and reset - their lifespans. When provided, Dialogflow uses this field to - populate [QueryResult.output_contexts][google.cloud.dialogflow - .v2beta1.QueryResult.output_contexts] sent to the integration - or API caller. - followup_event_input: - Optional. Invokes the supplied events. When this field is set, - Dialogflow ignores the ``fulfillment_text``, - ``fulfillment_messages``, and ``payload`` fields. - end_interaction: - Optional. Indicates that this intent ends an interaction. Some - integrations (e.g., Actions on Google or Dialogflow phone - gateway) use this information to close interaction with an end - user. Default is false. - session_entity_types: - Optional. Additional session entity types to replace or extend - developer entity types with. The entity synonyms apply to all - languages and persist for the session. Setting this data from - a webhook overwrites the session entity types that have been - set using ``detectIntent``, ``streamingDetectIntent`` or [Sess - ionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTy - pe] management methods. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.WebhookResponse) - }, -) -_sym_db.RegisterMessage(WebhookResponse) - -OriginalDetectIntentRequest = _reflection.GeneratedProtocolMessageType( - "OriginalDetectIntentRequest", - (_message.Message,), - { - "DESCRIPTOR": _ORIGINALDETECTINTENTREQUEST, - "__module__": "google.cloud.dialogflow_v2beta1.proto.webhook_pb2", - "__doc__": """Represents the contents of the original request that was passed to the - ``[Streaming]DetectIntent`` call. - - Attributes: - source: - The source of this request, e.g., ``google``, ``facebook``, - ``slack``. It is set by Dialogflow-owned servers. - version: - Optional. The version of the protocol used for this request. - This field is AoG-specific. - payload: - Optional. This field is set to the value of the - ``QueryParameters.payload`` field passed in the request. Some - integrations that query a Dialogflow agent may provide - additional information in the payload. In particular, for the - Dialogflow Phone Gateway integration, this field has the form: - .. raw:: html
{     "telephony": {       "caller_id":
-          "+18558363987"     }    }
Note: The caller ID field - (``caller_id``) will be redacted for Standard Edition agents - and populated with the caller ID in `E.164 format - `__ for Enterprise - Edition agents. - """, - # @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest) - }, -) -_sym_db.RegisterMessage(OriginalDetectIntentRequest) - - -DESCRIPTOR._options = None -# @@protoc_insertion_point(module_scope) diff --git a/dialogflow_v2beta1/proto/webhook_pb2_grpc.py b/dialogflow_v2beta1/proto/webhook_pb2_grpc.py deleted file mode 100644 index 8a9393943..000000000 --- a/dialogflow_v2beta1/proto/webhook_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/dialogflow_v2beta1/types.py b/dialogflow_v2beta1/types.py deleted file mode 100644 index d18160ab1..000000000 --- a/dialogflow_v2beta1/types.py +++ /dev/null @@ -1,88 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - - -from __future__ import absolute_import -import sys - -from google.api_core.protobuf_helpers import get_messages - -from dialogflow_v2beta1.proto import agent_pb2 -from dialogflow_v2beta1.proto import audio_config_pb2 -from dialogflow_v2beta1.proto import context_pb2 -from dialogflow_v2beta1.proto import document_pb2 -from dialogflow_v2beta1.proto import entity_type_pb2 -from dialogflow_v2beta1.proto import environment_pb2 -from dialogflow_v2beta1.proto import gcs_pb2 -from dialogflow_v2beta1.proto import intent_pb2 -from dialogflow_v2beta1.proto import knowledge_base_pb2 -from dialogflow_v2beta1.proto import session_entity_type_pb2 -from dialogflow_v2beta1.proto import session_pb2 -from dialogflow_v2beta1.proto import validation_result_pb2 -from dialogflow_v2beta1.proto import webhook_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import any_pb2 -from google.protobuf import duration_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import struct_pb2 -from google.protobuf import timestamp_pb2 -from google.rpc import status_pb2 -from google.type import latlng_pb2 - - -_shared_modules = [ - operations_pb2, - any_pb2, - duration_pb2, - empty_pb2, - field_mask_pb2, - struct_pb2, - timestamp_pb2, - status_pb2, - latlng_pb2, -] - -_local_modules = [ - agent_pb2, - audio_config_pb2, - context_pb2, - document_pb2, - entity_type_pb2, - environment_pb2, - gcs_pb2, - intent_pb2, - knowledge_base_pb2, - session_entity_type_pb2, - session_pb2, - validation_result_pb2, - webhook_pb2, -] - -names = [] - -for module in _shared_modules: # pragma: NO COVER - for name, message in get_messages(module).items(): - setattr(sys.modules[__name__], name, message) - names.append(name) -for module in _local_modules: - for name, message in get_messages(module).items(): - message.__module__ = "google.cloud.dialogflow_v2beta1.types" - setattr(sys.modules[__name__], name, message) - names.append(name) - - -__all__ = tuple(sorted(names)) diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md new file mode 120000 index 000000000..01097c8c0 --- /dev/null +++ b/docs/UPGRADING.md @@ -0,0 +1 @@ +../UPGRADING.md \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index e7ee58c07..e6912abdf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# dialogflow documentation build configuration file +# google-cloud-dialogflow documentation build configuration file # # This file is execfile()d with the current directory set to its # containing dir. @@ -67,7 +67,7 @@ master_doc = "index" # General information about the project. -project = u"dialogflow" +project = u"google-cloud-dialogflow" copyright = u"2019, Google" author = u"Google APIs" @@ -140,9 +140,9 @@ # further. For a list of options available for each theme, see the # documentation. html_theme_options = { - "description": "Google Cloud Client Libraries for dialogflow", + "description": "Google Cloud Client Libraries for google-cloud-dialogflow", "github_user": "googleapis", - "github_repo": "dialogflow-python-client-v2", + "github_repo": "python-dialogflow", "github_banner": True, "font_family": "'Roboto', Georgia, sans", "head_font_family": "'Roboto', Georgia, serif", @@ -234,7 +234,7 @@ # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = "dialogflow-doc" +htmlhelp_basename = "google-cloud-dialogflow-doc" # -- Options for warnings ------------------------------------------------------ @@ -265,7 +265,13 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, "dialogflow.tex", u"dialogflow Documentation", author, "manual") + ( + master_doc, + "google-cloud-dialogflow.tex", + u"google-cloud-dialogflow Documentation", + author, + "manual", + ) ] # The name of an image file (relative to this directory) to place at the top of @@ -293,7 +299,15 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, "dialogflow", u"dialogflow Documentation", [author], 1)] +man_pages = [ + ( + master_doc, + "google-cloud-dialogflow", + u"google-cloud-dialogflow Documentation", + [author], + 1, + ) +] # If true, show URL addresses after external links. # man_show_urls = False @@ -307,11 +321,11 @@ texinfo_documents = [ ( master_doc, - "dialogflow", - u"dialogflow Documentation", + "google-cloud-dialogflow", + u"google-cloud-dialogflow Documentation", author, - "dialogflow", - "dialogflow Library", + "google-cloud-dialogflow", + "google-cloud-dialogflow Library", "APIs", ) ] @@ -333,7 +347,7 @@ 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), } diff --git a/docs/dialogflow_v2/services.rst b/docs/dialogflow_v2/services.rst new file mode 100644 index 000000000..69a3904d0 --- /dev/null +++ b/docs/dialogflow_v2/services.rst @@ -0,0 +1,24 @@ +Services for Google Cloud Dialogflow v2 API +=========================================== + +.. automodule:: google.cloud.dialogflow_v2.services.agents + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2.services.contexts + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2.services.entity_types + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2.services.environments + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2.services.intents + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2.services.session_entity_types + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2.services.sessions + :members: + :inherited-members: diff --git a/docs/dialogflow_v2/types.rst b/docs/dialogflow_v2/types.rst new file mode 100644 index 000000000..3d0f4eb3c --- /dev/null +++ b/docs/dialogflow_v2/types.rst @@ -0,0 +1,6 @@ +Types for Google Cloud Dialogflow v2 API +======================================== + +.. automodule:: google.cloud.dialogflow_v2.types + :members: + :show-inheritance: diff --git a/docs/dialogflow_v2beta1/services.rst b/docs/dialogflow_v2beta1/services.rst new file mode 100644 index 000000000..9350d256f --- /dev/null +++ b/docs/dialogflow_v2beta1/services.rst @@ -0,0 +1,30 @@ +Services for Google Cloud Dialogflow v2beta1 API +================================================ + +.. automodule:: google.cloud.dialogflow_v2beta1.services.agents + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2beta1.services.contexts + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2beta1.services.documents + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2beta1.services.entity_types + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2beta1.services.environments + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2beta1.services.intents + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2beta1.services.knowledge_bases + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2beta1.services.session_entity_types + :members: + :inherited-members: +.. automodule:: google.cloud.dialogflow_v2beta1.services.sessions + :members: + :inherited-members: diff --git a/docs/dialogflow_v2beta1/types.rst b/docs/dialogflow_v2beta1/types.rst new file mode 100644 index 000000000..e50759342 --- /dev/null +++ b/docs/dialogflow_v2beta1/types.rst @@ -0,0 +1,6 @@ +Types for Google Cloud Dialogflow v2beta1 API +============================================= + +.. automodule:: google.cloud.dialogflow_v2beta1.types + :members: + :show-inheritance: diff --git a/docs/gapic/v2/api.rst b/docs/gapic/v2/api.rst deleted file mode 100644 index cb3eb8efa..000000000 --- a/docs/gapic/v2/api.rst +++ /dev/null @@ -1,6 +0,0 @@ -Client for Dialogflow API -========================= - -.. automodule:: dialogflow_v2 - :members: - :inherited-members: \ No newline at end of file diff --git a/docs/gapic/v2/types.rst b/docs/gapic/v2/types.rst deleted file mode 100644 index dde123c7f..000000000 --- a/docs/gapic/v2/types.rst +++ /dev/null @@ -1,5 +0,0 @@ -Types for Dialogflow API Client -=============================== - -.. automodule:: dialogflow_v2.types - :members: \ No newline at end of file diff --git a/docs/gapic/v2beta1/api.rst b/docs/gapic/v2beta1/api.rst deleted file mode 100644 index cb4c2b468..000000000 --- a/docs/gapic/v2beta1/api.rst +++ /dev/null @@ -1,6 +0,0 @@ -Client for Dialogflow API -========================= - -.. automodule:: dialogflow_v2beta1 - :members: - :inherited-members: \ No newline at end of file diff --git a/docs/gapic/v2beta1/types.rst b/docs/gapic/v2beta1/types.rst deleted file mode 100644 index f394c53b3..000000000 --- a/docs/gapic/v2beta1/types.rst +++ /dev/null @@ -1,5 +0,0 @@ -Types for Dialogflow API Client -=============================== - -.. automodule:: dialogflow_v2beta1.types - :members: \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 7c62c09a5..ade9bdbc1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,12 +1,33 @@ .. include:: README.rst -Api Reference +v2 ------------- .. toctree:: :maxdepth: 2 - v2 - v2beta1 + dialogflow_v2/services + dialogflow_v2/types + + + +v2beta1 +------------- +.. toctree:: + :maxdepth: 2 + + dialogflow_v2beta1/services + dialogflow_v2beta1/types + +Migration Guide +--------------- + +See the guide below for instructions on migrating to the 2.x release of this library. + +.. toctree:: + :maxdepth: 2 + + UPGRADING + Changelog ---------- diff --git a/docs/v2.rst b/docs/v2.rst deleted file mode 100644 index 80ad8e033..000000000 --- a/docs/v2.rst +++ /dev/null @@ -1,7 +0,0 @@ -v2 -------------- -.. toctree:: - :maxdepth: 2 - - gapic/v2/api - gapic/v2/types \ No newline at end of file diff --git a/docs/v2beta1.rst b/docs/v2beta1.rst deleted file mode 100644 index 64e77b5b8..000000000 --- a/docs/v2beta1.rst +++ /dev/null @@ -1,7 +0,0 @@ -v2beta1 -------------- -.. toctree:: - :maxdepth: 2 - - gapic/v2beta1/api - gapic/v2beta1/types \ No newline at end of file diff --git a/google/cloud/dialogflow/__init__.py b/google/cloud/dialogflow/__init__.py new file mode 100644 index 000000000..0afc0f343 --- /dev/null +++ b/google/cloud/dialogflow/__init__.py @@ -0,0 +1,240 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from google.cloud.dialogflow_v2.services.agents.async_client import AgentsAsyncClient +from google.cloud.dialogflow_v2.services.agents.client import AgentsClient +from google.cloud.dialogflow_v2.services.contexts.async_client import ( + ContextsAsyncClient, +) +from google.cloud.dialogflow_v2.services.contexts.client import ContextsClient +from google.cloud.dialogflow_v2.services.entity_types.async_client import ( + EntityTypesAsyncClient, +) +from google.cloud.dialogflow_v2.services.entity_types.client import EntityTypesClient +from google.cloud.dialogflow_v2.services.environments.async_client import ( + EnvironmentsAsyncClient, +) +from google.cloud.dialogflow_v2.services.environments.client import EnvironmentsClient +from google.cloud.dialogflow_v2.services.intents.async_client import IntentsAsyncClient +from google.cloud.dialogflow_v2.services.intents.client import IntentsClient +from google.cloud.dialogflow_v2.services.session_entity_types.async_client import ( + SessionEntityTypesAsyncClient, +) +from google.cloud.dialogflow_v2.services.session_entity_types.client import ( + SessionEntityTypesClient, +) +from google.cloud.dialogflow_v2.services.sessions.async_client import ( + SessionsAsyncClient, +) +from google.cloud.dialogflow_v2.services.sessions.client import SessionsClient +from google.cloud.dialogflow_v2.types.agent import Agent +from google.cloud.dialogflow_v2.types.agent import DeleteAgentRequest +from google.cloud.dialogflow_v2.types.agent import ExportAgentRequest +from google.cloud.dialogflow_v2.types.agent import ExportAgentResponse +from google.cloud.dialogflow_v2.types.agent import GetAgentRequest +from google.cloud.dialogflow_v2.types.agent import GetValidationResultRequest +from google.cloud.dialogflow_v2.types.agent import ImportAgentRequest +from google.cloud.dialogflow_v2.types.agent import RestoreAgentRequest +from google.cloud.dialogflow_v2.types.agent import SearchAgentsRequest +from google.cloud.dialogflow_v2.types.agent import SearchAgentsResponse +from google.cloud.dialogflow_v2.types.agent import SetAgentRequest +from google.cloud.dialogflow_v2.types.agent import TrainAgentRequest +from google.cloud.dialogflow_v2.types.audio_config import AudioEncoding +from google.cloud.dialogflow_v2.types.audio_config import InputAudioConfig +from google.cloud.dialogflow_v2.types.audio_config import OutputAudioConfig +from google.cloud.dialogflow_v2.types.audio_config import OutputAudioEncoding +from google.cloud.dialogflow_v2.types.audio_config import SpeechContext +from google.cloud.dialogflow_v2.types.audio_config import SpeechModelVariant +from google.cloud.dialogflow_v2.types.audio_config import SpeechWordInfo +from google.cloud.dialogflow_v2.types.audio_config import SsmlVoiceGender +from google.cloud.dialogflow_v2.types.audio_config import SynthesizeSpeechConfig +from google.cloud.dialogflow_v2.types.audio_config import VoiceSelectionParams +from google.cloud.dialogflow_v2.types.context import Context +from google.cloud.dialogflow_v2.types.context import CreateContextRequest +from google.cloud.dialogflow_v2.types.context import DeleteAllContextsRequest +from google.cloud.dialogflow_v2.types.context import DeleteContextRequest +from google.cloud.dialogflow_v2.types.context import GetContextRequest +from google.cloud.dialogflow_v2.types.context import ListContextsRequest +from google.cloud.dialogflow_v2.types.context import ListContextsResponse +from google.cloud.dialogflow_v2.types.context import UpdateContextRequest +from google.cloud.dialogflow_v2.types.entity_type import BatchCreateEntitiesRequest +from google.cloud.dialogflow_v2.types.entity_type import BatchDeleteEntitiesRequest +from google.cloud.dialogflow_v2.types.entity_type import BatchDeleteEntityTypesRequest +from google.cloud.dialogflow_v2.types.entity_type import BatchUpdateEntitiesRequest +from google.cloud.dialogflow_v2.types.entity_type import BatchUpdateEntityTypesRequest +from google.cloud.dialogflow_v2.types.entity_type import BatchUpdateEntityTypesResponse +from google.cloud.dialogflow_v2.types.entity_type import CreateEntityTypeRequest +from google.cloud.dialogflow_v2.types.entity_type import DeleteEntityTypeRequest +from google.cloud.dialogflow_v2.types.entity_type import EntityType +from google.cloud.dialogflow_v2.types.entity_type import EntityTypeBatch +from google.cloud.dialogflow_v2.types.entity_type import GetEntityTypeRequest +from google.cloud.dialogflow_v2.types.entity_type import ListEntityTypesRequest +from google.cloud.dialogflow_v2.types.entity_type import ListEntityTypesResponse +from google.cloud.dialogflow_v2.types.entity_type import UpdateEntityTypeRequest +from google.cloud.dialogflow_v2.types.environment import Environment +from google.cloud.dialogflow_v2.types.environment import ListEnvironmentsRequest +from google.cloud.dialogflow_v2.types.environment import ListEnvironmentsResponse +from google.cloud.dialogflow_v2.types.intent import BatchDeleteIntentsRequest +from google.cloud.dialogflow_v2.types.intent import BatchUpdateIntentsRequest +from google.cloud.dialogflow_v2.types.intent import BatchUpdateIntentsResponse +from google.cloud.dialogflow_v2.types.intent import CreateIntentRequest +from google.cloud.dialogflow_v2.types.intent import DeleteIntentRequest +from google.cloud.dialogflow_v2.types.intent import GetIntentRequest +from google.cloud.dialogflow_v2.types.intent import Intent +from google.cloud.dialogflow_v2.types.intent import IntentBatch +from google.cloud.dialogflow_v2.types.intent import IntentView +from google.cloud.dialogflow_v2.types.intent import ListIntentsRequest +from google.cloud.dialogflow_v2.types.intent import ListIntentsResponse +from google.cloud.dialogflow_v2.types.intent import UpdateIntentRequest +from google.cloud.dialogflow_v2.types.session import DetectIntentRequest +from google.cloud.dialogflow_v2.types.session import DetectIntentResponse +from google.cloud.dialogflow_v2.types.session import EventInput +from google.cloud.dialogflow_v2.types.session import QueryInput +from google.cloud.dialogflow_v2.types.session import QueryParameters +from google.cloud.dialogflow_v2.types.session import QueryResult +from google.cloud.dialogflow_v2.types.session import Sentiment +from google.cloud.dialogflow_v2.types.session import SentimentAnalysisRequestConfig +from google.cloud.dialogflow_v2.types.session import SentimentAnalysisResult +from google.cloud.dialogflow_v2.types.session import StreamingDetectIntentRequest +from google.cloud.dialogflow_v2.types.session import StreamingDetectIntentResponse +from google.cloud.dialogflow_v2.types.session import StreamingRecognitionResult +from google.cloud.dialogflow_v2.types.session import TextInput +from google.cloud.dialogflow_v2.types.session_entity_type import ( + CreateSessionEntityTypeRequest, +) +from google.cloud.dialogflow_v2.types.session_entity_type import ( + DeleteSessionEntityTypeRequest, +) +from google.cloud.dialogflow_v2.types.session_entity_type import ( + GetSessionEntityTypeRequest, +) +from google.cloud.dialogflow_v2.types.session_entity_type import ( + ListSessionEntityTypesRequest, +) +from google.cloud.dialogflow_v2.types.session_entity_type import ( + ListSessionEntityTypesResponse, +) +from google.cloud.dialogflow_v2.types.session_entity_type import SessionEntityType +from google.cloud.dialogflow_v2.types.session_entity_type import ( + UpdateSessionEntityTypeRequest, +) +from google.cloud.dialogflow_v2.types.validation_result import ValidationError +from google.cloud.dialogflow_v2.types.validation_result import ValidationResult +from google.cloud.dialogflow_v2.types.webhook import OriginalDetectIntentRequest +from google.cloud.dialogflow_v2.types.webhook import WebhookRequest +from google.cloud.dialogflow_v2.types.webhook import WebhookResponse + +__all__ = ( + "Agent", + "AgentsAsyncClient", + "AgentsClient", + "AudioEncoding", + "BatchCreateEntitiesRequest", + "BatchDeleteEntitiesRequest", + "BatchDeleteEntityTypesRequest", + "BatchDeleteIntentsRequest", + "BatchUpdateEntitiesRequest", + "BatchUpdateEntityTypesRequest", + "BatchUpdateEntityTypesResponse", + "BatchUpdateIntentsRequest", + "BatchUpdateIntentsResponse", + "Context", + "ContextsAsyncClient", + "ContextsClient", + "CreateContextRequest", + "CreateEntityTypeRequest", + "CreateIntentRequest", + "CreateSessionEntityTypeRequest", + "DeleteAgentRequest", + "DeleteAllContextsRequest", + "DeleteContextRequest", + "DeleteEntityTypeRequest", + "DeleteIntentRequest", + "DeleteSessionEntityTypeRequest", + "DetectIntentRequest", + "DetectIntentResponse", + "EntityType", + "EntityTypeBatch", + "EntityTypesAsyncClient", + "EntityTypesClient", + "Environment", + "EnvironmentsAsyncClient", + "EnvironmentsClient", + "EventInput", + "ExportAgentRequest", + "ExportAgentResponse", + "GetAgentRequest", + "GetContextRequest", + "GetEntityTypeRequest", + "GetIntentRequest", + "GetSessionEntityTypeRequest", + "GetValidationResultRequest", + "ImportAgentRequest", + "InputAudioConfig", + "Intent", + "IntentBatch", + "IntentView", + "IntentsAsyncClient", + "IntentsClient", + "ListContextsRequest", + "ListContextsResponse", + "ListEntityTypesRequest", + "ListEntityTypesResponse", + "ListEnvironmentsRequest", + "ListEnvironmentsResponse", + "ListIntentsRequest", + "ListIntentsResponse", + "ListSessionEntityTypesRequest", + "ListSessionEntityTypesResponse", + "OriginalDetectIntentRequest", + "OutputAudioConfig", + "OutputAudioEncoding", + "QueryInput", + "QueryParameters", + "QueryResult", + "RestoreAgentRequest", + "SearchAgentsRequest", + "SearchAgentsResponse", + "Sentiment", + "SentimentAnalysisRequestConfig", + "SentimentAnalysisResult", + "SessionEntityType", + "SessionEntityTypesAsyncClient", + "SessionEntityTypesClient", + "SessionsAsyncClient", + "SessionsClient", + "SetAgentRequest", + "SpeechContext", + "SpeechModelVariant", + "SpeechWordInfo", + "SsmlVoiceGender", + "StreamingDetectIntentRequest", + "StreamingDetectIntentResponse", + "StreamingRecognitionResult", + "SynthesizeSpeechConfig", + "TextInput", + "TrainAgentRequest", + "UpdateContextRequest", + "UpdateEntityTypeRequest", + "UpdateIntentRequest", + "UpdateSessionEntityTypeRequest", + "ValidationError", + "ValidationResult", + "VoiceSelectionParams", + "WebhookRequest", + "WebhookResponse", +) diff --git a/google/cloud/dialogflow/py.typed b/google/cloud/dialogflow/py.typed new file mode 100644 index 000000000..2c6e5af62 --- /dev/null +++ b/google/cloud/dialogflow/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-dialogflow package uses inline types. diff --git a/google/cloud/dialogflow_v2/__init__.py b/google/cloud/dialogflow_v2/__init__.py new file mode 100644 index 000000000..ebbdea1d2 --- /dev/null +++ b/google/cloud/dialogflow_v2/__init__.py @@ -0,0 +1,203 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .services.agents import AgentsClient +from .services.contexts import ContextsClient +from .services.entity_types import EntityTypesClient +from .services.environments import EnvironmentsClient +from .services.intents import IntentsClient +from .services.session_entity_types import SessionEntityTypesClient +from .services.sessions import SessionsClient +from .types.agent import Agent +from .types.agent import DeleteAgentRequest +from .types.agent import ExportAgentRequest +from .types.agent import ExportAgentResponse +from .types.agent import GetAgentRequest +from .types.agent import GetValidationResultRequest +from .types.agent import ImportAgentRequest +from .types.agent import RestoreAgentRequest +from .types.agent import SearchAgentsRequest +from .types.agent import SearchAgentsResponse +from .types.agent import SetAgentRequest +from .types.agent import TrainAgentRequest +from .types.audio_config import AudioEncoding +from .types.audio_config import InputAudioConfig +from .types.audio_config import OutputAudioConfig +from .types.audio_config import OutputAudioEncoding +from .types.audio_config import SpeechContext +from .types.audio_config import SpeechModelVariant +from .types.audio_config import SpeechWordInfo +from .types.audio_config import SsmlVoiceGender +from .types.audio_config import SynthesizeSpeechConfig +from .types.audio_config import VoiceSelectionParams +from .types.context import Context +from .types.context import CreateContextRequest +from .types.context import DeleteAllContextsRequest +from .types.context import DeleteContextRequest +from .types.context import GetContextRequest +from .types.context import ListContextsRequest +from .types.context import ListContextsResponse +from .types.context import UpdateContextRequest +from .types.entity_type import BatchCreateEntitiesRequest +from .types.entity_type import BatchDeleteEntitiesRequest +from .types.entity_type import BatchDeleteEntityTypesRequest +from .types.entity_type import BatchUpdateEntitiesRequest +from .types.entity_type import BatchUpdateEntityTypesRequest +from .types.entity_type import BatchUpdateEntityTypesResponse +from .types.entity_type import CreateEntityTypeRequest +from .types.entity_type import DeleteEntityTypeRequest +from .types.entity_type import EntityType +from .types.entity_type import EntityTypeBatch +from .types.entity_type import GetEntityTypeRequest +from .types.entity_type import ListEntityTypesRequest +from .types.entity_type import ListEntityTypesResponse +from .types.entity_type import UpdateEntityTypeRequest +from .types.environment import Environment +from .types.environment import ListEnvironmentsRequest +from .types.environment import ListEnvironmentsResponse +from .types.intent import BatchDeleteIntentsRequest +from .types.intent import BatchUpdateIntentsRequest +from .types.intent import BatchUpdateIntentsResponse +from .types.intent import CreateIntentRequest +from .types.intent import DeleteIntentRequest +from .types.intent import GetIntentRequest +from .types.intent import Intent +from .types.intent import IntentBatch +from .types.intent import IntentView +from .types.intent import ListIntentsRequest +from .types.intent import ListIntentsResponse +from .types.intent import UpdateIntentRequest +from .types.session import DetectIntentRequest +from .types.session import DetectIntentResponse +from .types.session import EventInput +from .types.session import QueryInput +from .types.session import QueryParameters +from .types.session import QueryResult +from .types.session import Sentiment +from .types.session import SentimentAnalysisRequestConfig +from .types.session import SentimentAnalysisResult +from .types.session import StreamingDetectIntentRequest +from .types.session import StreamingDetectIntentResponse +from .types.session import StreamingRecognitionResult +from .types.session import TextInput +from .types.session_entity_type import CreateSessionEntityTypeRequest +from .types.session_entity_type import DeleteSessionEntityTypeRequest +from .types.session_entity_type import GetSessionEntityTypeRequest +from .types.session_entity_type import ListSessionEntityTypesRequest +from .types.session_entity_type import ListSessionEntityTypesResponse +from .types.session_entity_type import SessionEntityType +from .types.session_entity_type import UpdateSessionEntityTypeRequest +from .types.validation_result import ValidationError +from .types.validation_result import ValidationResult +from .types.webhook import OriginalDetectIntentRequest +from .types.webhook import WebhookRequest +from .types.webhook import WebhookResponse + + +__all__ = ( + "Agent", + "AgentsClient", + "AudioEncoding", + "BatchCreateEntitiesRequest", + "BatchDeleteEntitiesRequest", + "BatchDeleteEntityTypesRequest", + "BatchDeleteIntentsRequest", + "BatchUpdateEntitiesRequest", + "BatchUpdateEntityTypesRequest", + "BatchUpdateEntityTypesResponse", + "BatchUpdateIntentsRequest", + "BatchUpdateIntentsResponse", + "Context", + "ContextsClient", + "CreateContextRequest", + "CreateEntityTypeRequest", + "CreateIntentRequest", + "CreateSessionEntityTypeRequest", + "DeleteAgentRequest", + "DeleteAllContextsRequest", + "DeleteContextRequest", + "DeleteEntityTypeRequest", + "DeleteIntentRequest", + "DeleteSessionEntityTypeRequest", + "DetectIntentRequest", + "DetectIntentResponse", + "EntityType", + "EntityTypeBatch", + "EntityTypesClient", + "Environment", + "EnvironmentsClient", + "EventInput", + "ExportAgentRequest", + "ExportAgentResponse", + "GetAgentRequest", + "GetContextRequest", + "GetEntityTypeRequest", + "GetIntentRequest", + "GetSessionEntityTypeRequest", + "GetValidationResultRequest", + "ImportAgentRequest", + "InputAudioConfig", + "Intent", + "IntentBatch", + "IntentView", + "IntentsClient", + "ListContextsRequest", + "ListContextsResponse", + "ListEntityTypesRequest", + "ListEntityTypesResponse", + "ListEnvironmentsRequest", + "ListEnvironmentsResponse", + "ListIntentsRequest", + "ListIntentsResponse", + "ListSessionEntityTypesRequest", + "ListSessionEntityTypesResponse", + "OriginalDetectIntentRequest", + "OutputAudioConfig", + "OutputAudioEncoding", + "QueryInput", + "QueryParameters", + "QueryResult", + "RestoreAgentRequest", + "SearchAgentsRequest", + "SearchAgentsResponse", + "Sentiment", + "SentimentAnalysisRequestConfig", + "SentimentAnalysisResult", + "SessionEntityType", + "SessionEntityTypesClient", + "SetAgentRequest", + "SpeechContext", + "SpeechModelVariant", + "SpeechWordInfo", + "SsmlVoiceGender", + "StreamingDetectIntentRequest", + "StreamingDetectIntentResponse", + "StreamingRecognitionResult", + "SynthesizeSpeechConfig", + "TextInput", + "TrainAgentRequest", + "UpdateContextRequest", + "UpdateEntityTypeRequest", + "UpdateIntentRequest", + "UpdateSessionEntityTypeRequest", + "ValidationError", + "ValidationResult", + "VoiceSelectionParams", + "WebhookRequest", + "WebhookResponse", + "SessionsClient", +) diff --git a/dialogflow_v2/proto/agent.proto b/google/cloud/dialogflow_v2/proto/agent.proto similarity index 99% rename from dialogflow_v2/proto/agent.proto rename to google/cloud/dialogflow_v2/proto/agent.proto index 1ce271736..82c1426c7 100644 --- a/dialogflow_v2/proto/agent.proto +++ b/google/cloud/dialogflow_v2/proto/agent.proto @@ -267,7 +267,10 @@ message Agent { bool enable_logging = 8 [(google.api.field_behavior) = OPTIONAL]; // Optional. Determines how intents are detected from user queries. - MatchMode match_mode = 9 [(google.api.field_behavior) = OPTIONAL]; + MatchMode match_mode = 9 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; // Optional. To filter out false positive results and still get variety in // matched natural language inputs for your agent, you can tune the machine diff --git a/dialogflow_v2/proto/audio_config.proto b/google/cloud/dialogflow_v2/proto/audio_config.proto similarity index 100% rename from dialogflow_v2/proto/audio_config.proto rename to google/cloud/dialogflow_v2/proto/audio_config.proto index 19b1e09b9..dcfd650fc 100644 --- a/dialogflow_v2/proto/audio_config.proto +++ b/google/cloud/dialogflow_v2/proto/audio_config.proto @@ -29,6 +29,36 @@ option java_outer_classname = "AudioConfigProto"; option java_package = "com.google.cloud.dialogflow.v2"; option objc_class_prefix = "DF"; +// Hints for the speech recognizer to help with recognition in a specific +// conversation state. +message SpeechContext { + // Optional. A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // This list can be used to: + // + // * improve accuracy for words and phrases you expect the user to say, + // e.g. typical commands for your Dialogflow agent + // * add additional words to the speech recognizer vocabulary + // * ... + // + // See the [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/quotas) for usage + // limits. + repeated string phrases = 1; + + // Optional. Boost for this context compared to other contexts: + // + // * If the boost is positive, Dialogflow will increase the probability that + // the phrases in this context are recognized over similar sounding phrases. + // * If the boost is unspecified or non-positive, Dialogflow will not apply + // any boost. + // + // Dialogflow recommends that you use boosts in the range (0, 20] and that you + // find a value that fits your use case with binary search. + float boost = 2; +} + // Audio encoding of the audio content sent in the conversational query request. // Refer to the // [Cloud Speech API @@ -78,36 +108,6 @@ enum AudioEncoding { AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; } -// Hints for the speech recognizer to help with recognition in a specific -// conversation state. -message SpeechContext { - // Optional. A list of strings containing words and phrases that the speech - // recognizer should recognize with higher likelihood. - // - // This list can be used to: - // - // * improve accuracy for words and phrases you expect the user to say, - // e.g. typical commands for your Dialogflow agent - // * add additional words to the speech recognizer vocabulary - // * ... - // - // See the [Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/quotas) for usage - // limits. - repeated string phrases = 1; - - // Optional. Boost for this context compared to other contexts: - // - // * If the boost is positive, Dialogflow will increase the probability that - // the phrases in this context are recognized over similar sounding phrases. - // * If the boost is unspecified or non-positive, Dialogflow will not apply - // any boost. - // - // Dialogflow recommends that you use boosts in the range (0, 20] and that you - // find a value that fits your use case with binary search. - float boost = 2; -} - // Information for a word recognized by the speech recognizer. message SpeechWordInfo { // The word this info is for. diff --git a/dialogflow_v2/proto/context.proto b/google/cloud/dialogflow_v2/proto/context.proto similarity index 100% rename from dialogflow_v2/proto/context.proto rename to google/cloud/dialogflow_v2/proto/context.proto diff --git a/dialogflow_v2/proto/entity_type.proto b/google/cloud/dialogflow_v2/proto/entity_type.proto similarity index 100% rename from dialogflow_v2/proto/entity_type.proto rename to google/cloud/dialogflow_v2/proto/entity_type.proto diff --git a/dialogflow_v2/proto/environment.proto b/google/cloud/dialogflow_v2/proto/environment.proto similarity index 100% rename from dialogflow_v2/proto/environment.proto rename to google/cloud/dialogflow_v2/proto/environment.proto diff --git a/dialogflow_v2/proto/intent.proto b/google/cloud/dialogflow_v2/proto/intent.proto similarity index 100% rename from dialogflow_v2/proto/intent.proto rename to google/cloud/dialogflow_v2/proto/intent.proto diff --git a/dialogflow_v2/proto/session.proto b/google/cloud/dialogflow_v2/proto/session.proto similarity index 85% rename from dialogflow_v2/proto/session.proto rename to google/cloud/dialogflow_v2/proto/session.proto index 96e7c2ced..b99214a4c 100644 --- a/dialogflow_v2/proto/session.proto +++ b/google/cloud/dialogflow_v2/proto/session.proto @@ -57,6 +57,10 @@ service Sessions { // as a result. This method is not idempotent, because it may cause contexts // and session entity types to be updated, which in turn might affect // results of future queries. + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) { option (google.api.http) = { post: "/v2/{session=projects/*/agent/sessions/*}:detectIntent" @@ -72,8 +76,12 @@ service Sessions { // Processes a natural language query in audio format in a streaming fashion // and returns structured, actionable data as a result. This method is only // available via the gRPC API (not REST). - rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse) { - } + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) + returns (stream StreamingDetectIntentResponse) {} } // The request to detect user's intent. @@ -90,6 +98,10 @@ message DetectIntentRequest { // // For more information, see the [API interactions // guide](https://cloud.google.com/dialogflow/docs/api-overview). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). string session = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -115,12 +127,14 @@ message DetectIntentRequest { // configured, no output audio is generated. OutputAudioConfig output_audio_config = 4; - // Mask for [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] indicating which settings in this - // request-level config should override speech synthesizer settings defined at - // agent-level. + // Mask for + // [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] + // indicating which settings in this request-level config should override + // speech synthesizer settings defined at agent-level. // - // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] replaces the agent-level - // config in its entirety. + // If unspecified or empty, + // [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] + // replaces the agent-level config in its entirety. google.protobuf.FieldMask output_audio_config_mask = 7; // The natural language speech audio to be processed. This field @@ -192,6 +206,17 @@ message QueryParameters { // Configures the type of sentiment analysis to perform. If not // provided, sentiment analysis is not performed. SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10; + + // 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 configured through the Dialogflow web console. The headers + // defined within this field will overwrite the headers configured through the + // Dialogflow console if there is a conflict. Header names are + // case-insensitive. Google's specified headers are not allowed. Including: + // "Host", "Content-Length", "Connection", "From", "User-Agent", + // "Accept-Encoding", "If-Modified-Since", "If-None-Match", "X-Forwarded-For", + // etc. + map webhook_headers = 14; } // Represents the query input. It can contain either: @@ -325,25 +350,29 @@ message QueryResult { } // The top-level message sent by the client to the -// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent] method. +// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent] +// method. // // Multiple request messages should be sent in order: // // 1. The first message must contain // [session][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session], -// [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] plus optionally -// [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. If the client -// wants to receive an audio response, it should also contain +// [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] +// plus optionally +// [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. +// If the client wants to receive an audio response, it should also contain // [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]. // The message must not contain // [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]. -// 2. If [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] was set to -// [query_input.audio_config][google.cloud.dialogflow.v2.InputAudioConfig], all subsequent -// messages must contain -// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio] to continue with -// Speech recognition. -// If you decide to rather detect an intent from text input after you -// already started Speech recognition, please send a message with +// 2. If +// [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] +// was set to +// [query_input.audio_config][google.cloud.dialogflow.v2.InputAudioConfig], +// all subsequent messages must contain +// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio] +// to continue with Speech recognition. If you decide to rather detect an +// intent from text input after you already started Speech recognition, +// please send a message with // [query_input.text][google.cloud.dialogflow.v2.QueryInput.text]. // // However, note that: @@ -368,6 +397,10 @@ message StreamingDetectIntentRequest { // // For more information, see the [API interactions // guide](https://cloud.google.com/dialogflow/docs/api-overview). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). string session = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -388,14 +421,15 @@ message StreamingDetectIntentRequest { // 3. an event that specifies which intent to trigger. QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; - // Please use [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2.InputAudioConfig.single_utterance] instead. - // If `false` (default), recognition does not cease until - // the client closes the stream. If `true`, the recognizer will detect a - // single spoken utterance in input audio. Recognition ceases when it detects - // the audio's voice has stopped or paused. In this case, once a detected - // intent is received, the client should close the stream and start a new - // request with a new stream as needed. - // This setting is ignored when `query_input` is a piece of text or an event. + // Please use + // [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2.InputAudioConfig.single_utterance] + // instead. If `false` (default), recognition does not cease until the client + // closes the stream. If `true`, the recognizer will detect a single spoken + // utterance in input audio. Recognition ceases when it detects the audio's + // voice has stopped or paused. In this case, once a detected intent is + // received, the client should close the stream and start a new request with a + // new stream as needed. This setting is ignored when `query_input` is a piece + // of text or an event. bool single_utterance = 4 [deprecated = true]; // Instructs the speech synthesizer how to generate the output @@ -403,12 +437,14 @@ message StreamingDetectIntentRequest { // configured, no output audio is generated. OutputAudioConfig output_audio_config = 5; - // Mask for [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] indicating which settings in this - // request-level config should override speech synthesizer settings defined at - // agent-level. + // Mask for + // [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] + // indicating which settings in this request-level config should override + // speech synthesizer settings defined at agent-level. // - // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] replaces the agent-level - // config in its entirety. + // If unspecified or empty, + // [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] + // replaces the agent-level config in its entirety. google.protobuf.FieldMask output_audio_config_mask = 7; // The input audio content to be recognized. Must be sent if @@ -503,11 +539,12 @@ message StreamingRecognitionResult { // Event indicates that the server has detected the end of the user's speech // utterance and expects no additional inputs. - // Therefore, the server will not process additional audio (although it may subsequently return additional results). The - // client should stop sending additional audio data, half-close the gRPC - // connection, and wait for any additional results until the server closes - // the gRPC connection. This message is only sent if `single_utterance` was - // set to `true`, and is not used otherwise. + // Therefore, the server will not process additional audio (although it may + // subsequently return additional results). The client should stop sending + // additional audio data, half-close the gRPC connection, and wait for any + // additional results until the server closes the gRPC connection. This + // message is only sent if `single_utterance` was set to `true`, and is not + // used otherwise. END_OF_SINGLE_UTTERANCE = 2; } @@ -534,7 +571,8 @@ message StreamingRecognitionResult { float confidence = 4; // Word-specific information for the words recognized by Speech in - // [transcript][google.cloud.dialogflow.v2.StreamingRecognitionResult.transcript]. Populated if and only if `message_type` = `TRANSCRIPT` and + // [transcript][google.cloud.dialogflow.v2.StreamingRecognitionResult.transcript]. + // Populated if and only if `message_type` = `TRANSCRIPT` and // [InputAudioConfig.enable_word_info] is set. repeated SpeechWordInfo speech_word_info = 7; @@ -600,12 +638,15 @@ message SentimentAnalysisRequestConfig { // The result of sentiment analysis. Sentiment analysis inspects user input // and identifies the prevailing subjective opinion, especially to determine a // user's attitude as positive, negative, or neutral. -// For [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent], it needs to be configured in -// [DetectIntentRequest.query_params][google.cloud.dialogflow.v2.DetectIntentRequest.query_params]. For -// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent], it needs to be configured in +// For [Participants.DetectIntent][], it needs to be configured in +// [DetectIntentRequest.query_params][google.cloud.dialogflow.v2.DetectIntentRequest.query_params]. +// For [Participants.StreamingDetectIntent][], it needs to be configured in // [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. -// And for [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and -// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent], it needs to be configured in +// And for +// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] +// and +// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent], +// it needs to be configured in // [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2.ConversationProfile.human_agent_assistant_config] message SentimentAnalysisResult { // The sentiment analysis result for `query_text`. diff --git a/dialogflow_v2/proto/session_entity_type.proto b/google/cloud/dialogflow_v2/proto/session_entity_type.proto similarity index 100% rename from dialogflow_v2/proto/session_entity_type.proto rename to google/cloud/dialogflow_v2/proto/session_entity_type.proto diff --git a/dialogflow_v2/proto/validation_result.proto b/google/cloud/dialogflow_v2/proto/validation_result.proto similarity index 100% rename from dialogflow_v2/proto/validation_result.proto rename to google/cloud/dialogflow_v2/proto/validation_result.proto diff --git a/dialogflow_v2/proto/webhook.proto b/google/cloud/dialogflow_v2/proto/webhook.proto similarity index 98% rename from dialogflow_v2/proto/webhook.proto rename to google/cloud/dialogflow_v2/proto/webhook.proto index 509649a74..19f529aed 100644 --- a/dialogflow_v2/proto/webhook.proto +++ b/google/cloud/dialogflow_v2/proto/webhook.proto @@ -138,8 +138,8 @@ message OriginalDetectIntentRequest { // "caller_id": "+18558363987" // } // } - // Note: The caller ID field (`caller_id`) will be redacted for Standard + // Note: The caller ID field (`caller_id`) will be redacted for Trial // Edition agents and populated with the caller ID in [E.164 - // format](https://en.wikipedia.org/wiki/E.164) for Enterprise Edition agents. + // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents. google.protobuf.Struct payload = 3; } diff --git a/google/cloud/dialogflow_v2/py.typed b/google/cloud/dialogflow_v2/py.typed new file mode 100644 index 000000000..2c6e5af62 --- /dev/null +++ b/google/cloud/dialogflow_v2/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-dialogflow package uses inline types. diff --git a/google/cloud/dialogflow_v2/services/__init__.py b/google/cloud/dialogflow_v2/services/__init__.py new file mode 100644 index 000000000..42ffdf2bc --- /dev/null +++ b/google/cloud/dialogflow_v2/services/__init__.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# diff --git a/tests/unit/test_versionless.py b/google/cloud/dialogflow_v2/services/agents/__init__.py similarity index 62% rename from tests/unit/test_versionless.py rename to google/cloud/dialogflow_v2/services/agents/__init__.py index c45f08258..4bcbd7ac8 100644 --- a/tests/unit/test_versionless.py +++ b/google/cloud/dialogflow_v2/services/agents/__init__.py @@ -1,4 +1,6 @@ -# Copyright 2017, Google LLC +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,15 +13,12 @@ # 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. +# -import dialogflow -import dialogflow_v2 - - -def test_versionless(): - """Establish that the versioned import maps to the versionless one.""" +from .client import AgentsClient +from .async_client import AgentsAsyncClient - for key in dir(dialogflow): - if key.startswith("_"): - continue - assert getattr(dialogflow_v2, key) is getattr(dialogflow, key) +__all__ = ( + "AgentsClient", + "AgentsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2/services/agents/async_client.py b/google/cloud/dialogflow_v2/services/agents/async_client.py new file mode 100644 index 000000000..a108ea61c --- /dev/null +++ b/google/cloud/dialogflow_v2/services/agents/async_client.py @@ -0,0 +1,883 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2.services.agents import pagers +from google.cloud.dialogflow_v2.types import agent +from google.cloud.dialogflow_v2.types import agent as gcd_agent +from google.cloud.dialogflow_v2.types import validation_result +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import AgentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import AgentsGrpcAsyncIOTransport +from .client import AgentsClient + + +class AgentsAsyncClient: + """Service for managing [Agents][google.cloud.dialogflow.v2.Agent].""" + + _client: AgentsClient + + DEFAULT_ENDPOINT = AgentsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = AgentsClient.DEFAULT_MTLS_ENDPOINT + + agent_path = staticmethod(AgentsClient.agent_path) + parse_agent_path = staticmethod(AgentsClient.parse_agent_path) + + common_billing_account_path = staticmethod(AgentsClient.common_billing_account_path) + parse_common_billing_account_path = staticmethod( + AgentsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(AgentsClient.common_folder_path) + parse_common_folder_path = staticmethod(AgentsClient.parse_common_folder_path) + + common_organization_path = staticmethod(AgentsClient.common_organization_path) + parse_common_organization_path = staticmethod( + AgentsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(AgentsClient.common_project_path) + parse_common_project_path = staticmethod(AgentsClient.parse_common_project_path) + + common_location_path = staticmethod(AgentsClient.common_location_path) + parse_common_location_path = staticmethod(AgentsClient.parse_common_location_path) + + from_service_account_file = AgentsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> AgentsTransport: + """Return the transport used by the client instance. + + Returns: + AgentsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(AgentsClient).get_transport_class, type(AgentsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, AgentsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the agents client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.AgentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = AgentsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def get_agent( + self, + request: agent.GetAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> agent.Agent: + r"""Retrieves the specified agent. + + Args: + request (:class:`~.agent.GetAgentRequest`): + The request object. The request message for + [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent]. + parent (:class:`str`): + Required. The project that the agent to fetch is + associated with. Format: ``projects/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.agent.Agent: + A Dialogflow agent is a virtual agent that handles + conversations with your end-users. It is a natural + language understanding module that understands the + nuances of human language. Dialogflow translates + end-user text or audio during a conversation to + structured data that your apps and services can + understand. You design and build a Dialogflow agent to + handle the types of conversations required for your + system. + + For more information about agents, see the `Agent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = agent.GetAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def set_agent( + self, + request: gcd_agent.SetAgentRequest = None, + *, + agent: gcd_agent.Agent = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_agent.Agent: + r"""Creates/updates the specified agent. + + Args: + request (:class:`~.gcd_agent.SetAgentRequest`): + The request object. The request message for + [Agents.SetAgent][google.cloud.dialogflow.v2.Agents.SetAgent]. + agent (:class:`~.gcd_agent.Agent`): + Required. The agent to update. + This corresponds to the ``agent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_agent.Agent: + A Dialogflow agent is a virtual agent that handles + conversations with your end-users. It is a natural + language understanding module that understands the + nuances of human language. Dialogflow translates + end-user text or audio during a conversation to + structured data that your apps and services can + understand. You design and build a Dialogflow agent to + handle the types of conversations required for your + system. + + For more information about agents, see the `Agent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([agent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_agent.SetAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if agent is not None: + request.agent = agent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.set_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("agent.parent", request.agent.parent),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_agent( + self, + request: agent.DeleteAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified agent. + + Args: + request (:class:`~.agent.DeleteAgentRequest`): + The request object. The request message for + [Agents.DeleteAgent][google.cloud.dialogflow.v2.Agents.DeleteAgent]. + parent (:class:`str`): + Required. The project that the agent to delete is + associated with. Format: ``projects/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = agent.DeleteAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def search_agents( + self, + request: agent.SearchAgentsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.SearchAgentsAsyncPager: + r"""Returns the list of agents. + + Since there is at most one conversational agent per project, + this method is useful primarily for listing all agents across + projects the caller has access to. One can achieve that with a + wildcard project collection id "-". Refer to `List + Sub-Collections `__. + + Args: + request (:class:`~.agent.SearchAgentsRequest`): + The request object. The request message for + [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. + parent (:class:`str`): + Required. The project to list agents from. Format: + ``projects/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.SearchAgentsAsyncPager: + The response message for + [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = agent.SearchAgentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.search_agents, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.SearchAgentsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def train_agent( + self, + request: agent.TrainAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Trains the specified agent. + + Operation + + Args: + request (:class:`~.agent.TrainAgentRequest`): + The request object. The request message for + [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent]. + parent (:class:`str`): + Required. The project that the agent to train is + associated with. Format: ``projects/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = agent.TrainAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.train_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def export_agent( + self, + request: agent.ExportAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Exports the specified agent to a ZIP file. + + Operation + + Args: + request (:class:`~.agent.ExportAgentRequest`): + The request object. The request message for + [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. + parent (:class:`str`): + Required. The project that the agent to export is + associated with. Format: ``projects/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.agent.ExportAgentResponse``: The response + message for + [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = agent.ExportAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.export_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + agent.ExportAgentResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def import_agent( + self, + request: agent.ImportAgentRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Imports the specified agent from a ZIP file. + + Uploads new intents and entity types without deleting the + existing ones. Intents and entity types with the same name are + replaced with the new versions from + [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. + After the import, the imported draft agent will be trained + automatically (unless disabled in agent settings). However, once + the import is done, training may not be completed yet. Please + call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when importing is complete. It only tracks when the + draft agent is updated not when it is done training. + + Args: + request (:class:`~.agent.ImportAgentRequest`): + The request object. The request message for + [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + + request = agent.ImportAgentRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.import_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def restore_agent( + self, + request: agent.RestoreAgentRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Restores the specified agent from a ZIP file. + + Replaces the current agent version with a new one. All the + intents and entity types in the older version are deleted. After + the restore, the restored draft agent will be trained + automatically (unless disabled in agent settings). However, once + the restore is done, training may not be completed yet. Please + call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when restoring is complete. It only tracks when the + draft agent is updated not when it is done training. + + Args: + request (:class:`~.agent.RestoreAgentRequest`): + The request object. The request message for + [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + + request = agent.RestoreAgentRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.restore_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def get_validation_result( + self, + request: agent.GetValidationResultRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> validation_result.ValidationResult: + r"""Gets agent validation result. Agent validation is + performed during training time and is updated + automatically when training is completed. + + Args: + request (:class:`~.agent.GetValidationResultRequest`): + The request object. The request message for + [Agents.GetValidationResult][google.cloud.dialogflow.v2.Agents.GetValidationResult]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.validation_result.ValidationResult: + Represents the output of agent + validation. + + """ + # Create or coerce a protobuf request object. + + request = agent.GetValidationResultRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_validation_result, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("AgentsAsyncClient",) diff --git a/google/cloud/dialogflow_v2/services/agents/client.py b/google/cloud/dialogflow_v2/services/agents/client.py new file mode 100644 index 000000000..f57fa7c1b --- /dev/null +++ b/google/cloud/dialogflow_v2/services/agents/client.py @@ -0,0 +1,1086 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2.services.agents import pagers +from google.cloud.dialogflow_v2.types import agent +from google.cloud.dialogflow_v2.types import agent as gcd_agent +from google.cloud.dialogflow_v2.types import validation_result +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import AgentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import AgentsGrpcTransport +from .transports.grpc_asyncio import AgentsGrpcAsyncIOTransport + + +class AgentsClientMeta(type): + """Metaclass for the Agents client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[AgentsTransport]] + _transport_registry["grpc"] = AgentsGrpcTransport + _transport_registry["grpc_asyncio"] = AgentsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[AgentsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class AgentsClient(metaclass=AgentsClientMeta): + """Service for managing [Agents][google.cloud.dialogflow.v2.Agent].""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> AgentsTransport: + """Return the transport used by the client instance. + + Returns: + AgentsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def agent_path(project: str,) -> str: + """Return a fully-qualified agent string.""" + return "projects/{project}/agent".format(project=project,) + + @staticmethod + def parse_agent_path(path: str) -> Dict[str, str]: + """Parse a agent path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/agent$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, AgentsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the agents client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.AgentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, AgentsTransport): + # transport is a AgentsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def get_agent( + self, + request: agent.GetAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> agent.Agent: + r"""Retrieves the specified agent. + + Args: + request (:class:`~.agent.GetAgentRequest`): + The request object. The request message for + [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent]. + parent (:class:`str`): + Required. The project that the agent to fetch is + associated with. Format: ``projects/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.agent.Agent: + A Dialogflow agent is a virtual agent that handles + conversations with your end-users. It is a natural + language understanding module that understands the + nuances of human language. Dialogflow translates + end-user text or audio during a conversation to + structured data that your apps and services can + understand. You design and build a Dialogflow agent to + handle the types of conversations required for your + system. + + For more information about agents, see the `Agent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a agent.GetAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.GetAgentRequest): + request = agent.GetAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def set_agent( + self, + request: gcd_agent.SetAgentRequest = None, + *, + agent: gcd_agent.Agent = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_agent.Agent: + r"""Creates/updates the specified agent. + + Args: + request (:class:`~.gcd_agent.SetAgentRequest`): + The request object. The request message for + [Agents.SetAgent][google.cloud.dialogflow.v2.Agents.SetAgent]. + agent (:class:`~.gcd_agent.Agent`): + Required. The agent to update. + This corresponds to the ``agent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_agent.Agent: + A Dialogflow agent is a virtual agent that handles + conversations with your end-users. It is a natural + language understanding module that understands the + nuances of human language. Dialogflow translates + end-user text or audio during a conversation to + structured data that your apps and services can + understand. You design and build a Dialogflow agent to + handle the types of conversations required for your + system. + + For more information about agents, see the `Agent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([agent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_agent.SetAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_agent.SetAgentRequest): + request = gcd_agent.SetAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if agent is not None: + request.agent = agent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("agent.parent", request.agent.parent),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_agent( + self, + request: agent.DeleteAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified agent. + + Args: + request (:class:`~.agent.DeleteAgentRequest`): + The request object. The request message for + [Agents.DeleteAgent][google.cloud.dialogflow.v2.Agents.DeleteAgent]. + parent (:class:`str`): + Required. The project that the agent to delete is + associated with. Format: ``projects/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a agent.DeleteAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.DeleteAgentRequest): + request = agent.DeleteAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def search_agents( + self, + request: agent.SearchAgentsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.SearchAgentsPager: + r"""Returns the list of agents. + + Since there is at most one conversational agent per project, + this method is useful primarily for listing all agents across + projects the caller has access to. One can achieve that with a + wildcard project collection id "-". Refer to `List + Sub-Collections `__. + + Args: + request (:class:`~.agent.SearchAgentsRequest`): + The request object. The request message for + [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. + parent (:class:`str`): + Required. The project to list agents from. Format: + ``projects/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.SearchAgentsPager: + The response message for + [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a agent.SearchAgentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.SearchAgentsRequest): + request = agent.SearchAgentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.search_agents] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.SearchAgentsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def train_agent( + self, + request: agent.TrainAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Trains the specified agent. + + Operation + + Args: + request (:class:`~.agent.TrainAgentRequest`): + The request object. The request message for + [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent]. + parent (:class:`str`): + Required. The project that the agent to train is + associated with. Format: ``projects/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a agent.TrainAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.TrainAgentRequest): + request = agent.TrainAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.train_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def export_agent( + self, + request: agent.ExportAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Exports the specified agent to a ZIP file. + + Operation + + Args: + request (:class:`~.agent.ExportAgentRequest`): + The request object. The request message for + [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. + parent (:class:`str`): + Required. The project that the agent to export is + associated with. Format: ``projects/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.agent.ExportAgentResponse``: The response + message for + [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a agent.ExportAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.ExportAgentRequest): + request = agent.ExportAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.export_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + agent.ExportAgentResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def import_agent( + self, + request: agent.ImportAgentRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Imports the specified agent from a ZIP file. + + Uploads new intents and entity types without deleting the + existing ones. Intents and entity types with the same name are + replaced with the new versions from + [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. + After the import, the imported draft agent will be trained + automatically (unless disabled in agent settings). However, once + the import is done, training may not be completed yet. Please + call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when importing is complete. It only tracks when the + draft agent is updated not when it is done training. + + Args: + request (:class:`~.agent.ImportAgentRequest`): + The request object. The request message for + [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a agent.ImportAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.ImportAgentRequest): + request = agent.ImportAgentRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.import_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def restore_agent( + self, + request: agent.RestoreAgentRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Restores the specified agent from a ZIP file. + + Replaces the current agent version with a new one. All the + intents and entity types in the older version are deleted. After + the restore, the restored draft agent will be trained + automatically (unless disabled in agent settings). However, once + the restore is done, training may not be completed yet. Please + call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when restoring is complete. It only tracks when the + draft agent is updated not when it is done training. + + Args: + request (:class:`~.agent.RestoreAgentRequest`): + The request object. The request message for + [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a agent.RestoreAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.RestoreAgentRequest): + request = agent.RestoreAgentRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.restore_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def get_validation_result( + self, + request: agent.GetValidationResultRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> validation_result.ValidationResult: + r"""Gets agent validation result. Agent validation is + performed during training time and is updated + automatically when training is completed. + + Args: + request (:class:`~.agent.GetValidationResultRequest`): + The request object. The request message for + [Agents.GetValidationResult][google.cloud.dialogflow.v2.Agents.GetValidationResult]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.validation_result.ValidationResult: + Represents the output of agent + validation. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a agent.GetValidationResultRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.GetValidationResultRequest): + request = agent.GetValidationResultRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_validation_result] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("AgentsClient",) diff --git a/google/cloud/dialogflow_v2/services/agents/pagers.py b/google/cloud/dialogflow_v2/services/agents/pagers.py new file mode 100644 index 000000000..a05bff566 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/agents/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2.types import agent + + +class SearchAgentsPager: + """A pager for iterating through ``search_agents`` requests. + + This class thinly wraps an initial + :class:`~.agent.SearchAgentsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``agents`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``SearchAgents`` requests and continue to iterate + through the ``agents`` field on the + corresponding responses. + + All the usual :class:`~.agent.SearchAgentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., agent.SearchAgentsResponse], + request: agent.SearchAgentsRequest, + response: agent.SearchAgentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.agent.SearchAgentsRequest`): + The initial request object. + response (:class:`~.agent.SearchAgentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = agent.SearchAgentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[agent.SearchAgentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[agent.Agent]: + for page in self.pages: + yield from page.agents + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class SearchAgentsAsyncPager: + """A pager for iterating through ``search_agents`` requests. + + This class thinly wraps an initial + :class:`~.agent.SearchAgentsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``agents`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``SearchAgents`` requests and continue to iterate + through the ``agents`` field on the + corresponding responses. + + All the usual :class:`~.agent.SearchAgentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[agent.SearchAgentsResponse]], + request: agent.SearchAgentsRequest, + response: agent.SearchAgentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.agent.SearchAgentsRequest`): + The initial request object. + response (:class:`~.agent.SearchAgentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = agent.SearchAgentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[agent.SearchAgentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[agent.Agent]: + async def async_generator(): + async for page in self.pages: + for response in page.agents: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2/services/agents/transports/__init__.py b/google/cloud/dialogflow_v2/services/agents/transports/__init__.py new file mode 100644 index 000000000..a87abc01d --- /dev/null +++ b/google/cloud/dialogflow_v2/services/agents/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import AgentsTransport +from .grpc import AgentsGrpcTransport +from .grpc_asyncio import AgentsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[AgentsTransport]] +_transport_registry["grpc"] = AgentsGrpcTransport +_transport_registry["grpc_asyncio"] = AgentsGrpcAsyncIOTransport + + +__all__ = ( + "AgentsTransport", + "AgentsGrpcTransport", + "AgentsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2/services/agents/transports/base.py b/google/cloud/dialogflow_v2/services/agents/transports/base.py new file mode 100644 index 000000000..8987cfbe7 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/agents/transports/base.py @@ -0,0 +1,240 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2.types import agent +from google.cloud.dialogflow_v2.types import agent as gcd_agent +from google.cloud.dialogflow_v2.types import validation_result +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class AgentsTransport(abc.ABC): + """Abstract transport class for Agents.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.get_agent: gapic_v1.method.wrap_method( + self.get_agent, default_timeout=None, client_info=client_info, + ), + self.set_agent: gapic_v1.method.wrap_method( + self.set_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.search_agents: gapic_v1.method.wrap_method( + self.search_agents, default_timeout=None, client_info=client_info, + ), + self.train_agent: gapic_v1.method.wrap_method( + self.train_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.import_agent: gapic_v1.method.wrap_method( + self.import_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.get_validation_result: gapic_v1.method.wrap_method( + self.get_validation_result, + default_timeout=None, + client_info=client_info, + ), + } + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def get_agent( + self, + ) -> typing.Callable[ + [agent.GetAgentRequest], + typing.Union[agent.Agent, typing.Awaitable[agent.Agent]], + ]: + raise NotImplementedError() + + @property + def set_agent( + self, + ) -> typing.Callable[ + [gcd_agent.SetAgentRequest], + typing.Union[gcd_agent.Agent, typing.Awaitable[gcd_agent.Agent]], + ]: + raise NotImplementedError() + + @property + def delete_agent( + self, + ) -> typing.Callable[ + [agent.DeleteAgentRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def search_agents( + self, + ) -> typing.Callable[ + [agent.SearchAgentsRequest], + typing.Union[ + agent.SearchAgentsResponse, typing.Awaitable[agent.SearchAgentsResponse] + ], + ]: + raise NotImplementedError() + + @property + def train_agent( + self, + ) -> typing.Callable[ + [agent.TrainAgentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def export_agent( + self, + ) -> typing.Callable[ + [agent.ExportAgentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def import_agent( + self, + ) -> typing.Callable[ + [agent.ImportAgentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def restore_agent( + self, + ) -> typing.Callable[ + [agent.RestoreAgentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def get_validation_result( + self, + ) -> typing.Callable[ + [agent.GetValidationResultRequest], + typing.Union[ + validation_result.ValidationResult, + typing.Awaitable[validation_result.ValidationResult], + ], + ]: + raise NotImplementedError() + + +__all__ = ("AgentsTransport",) diff --git a/google/cloud/dialogflow_v2/services/agents/transports/grpc.py b/google/cloud/dialogflow_v2/services/agents/transports/grpc.py new file mode 100644 index 000000000..6ff6b8556 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/agents/transports/grpc.py @@ -0,0 +1,526 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2.types import agent +from google.cloud.dialogflow_v2.types import agent as gcd_agent +from google.cloud.dialogflow_v2.types import validation_result +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import AgentsTransport, DEFAULT_CLIENT_INFO + + +class AgentsGrpcTransport(AgentsTransport): + """gRPC backend transport for Agents. + + Service for managing [Agents][google.cloud.dialogflow.v2.Agent]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def get_agent(self) -> Callable[[agent.GetAgentRequest], agent.Agent]: + r"""Return a callable for the get agent method over gRPC. + + Retrieves the specified agent. + + Returns: + Callable[[~.GetAgentRequest], + ~.Agent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_agent" not in self._stubs: + self._stubs["get_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/GetAgent", + request_serializer=agent.GetAgentRequest.serialize, + response_deserializer=agent.Agent.deserialize, + ) + return self._stubs["get_agent"] + + @property + def set_agent(self) -> Callable[[gcd_agent.SetAgentRequest], gcd_agent.Agent]: + r"""Return a callable for the set agent method over gRPC. + + Creates/updates the specified agent. + + Returns: + Callable[[~.SetAgentRequest], + ~.Agent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "set_agent" not in self._stubs: + self._stubs["set_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/SetAgent", + request_serializer=gcd_agent.SetAgentRequest.serialize, + response_deserializer=gcd_agent.Agent.deserialize, + ) + return self._stubs["set_agent"] + + @property + def delete_agent(self) -> Callable[[agent.DeleteAgentRequest], empty.Empty]: + r"""Return a callable for the delete agent method over gRPC. + + Deletes the specified agent. + + Returns: + Callable[[~.DeleteAgentRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_agent" not in self._stubs: + self._stubs["delete_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/DeleteAgent", + request_serializer=agent.DeleteAgentRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_agent"] + + @property + def search_agents( + self, + ) -> Callable[[agent.SearchAgentsRequest], agent.SearchAgentsResponse]: + r"""Return a callable for the search agents method over gRPC. + + Returns the list of agents. + + Since there is at most one conversational agent per project, + this method is useful primarily for listing all agents across + projects the caller has access to. One can achieve that with a + wildcard project collection id "-". Refer to `List + Sub-Collections `__. + + Returns: + Callable[[~.SearchAgentsRequest], + ~.SearchAgentsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "search_agents" not in self._stubs: + self._stubs["search_agents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/SearchAgents", + request_serializer=agent.SearchAgentsRequest.serialize, + response_deserializer=agent.SearchAgentsResponse.deserialize, + ) + return self._stubs["search_agents"] + + @property + def train_agent(self) -> Callable[[agent.TrainAgentRequest], operations.Operation]: + r"""Return a callable for the train agent method over gRPC. + + Trains the specified agent. + + Operation + + Returns: + Callable[[~.TrainAgentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "train_agent" not in self._stubs: + self._stubs["train_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/TrainAgent", + request_serializer=agent.TrainAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["train_agent"] + + @property + def export_agent( + self, + ) -> Callable[[agent.ExportAgentRequest], operations.Operation]: + r"""Return a callable for the export agent method over gRPC. + + Exports the specified agent to a ZIP file. + + Operation + + Returns: + Callable[[~.ExportAgentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "export_agent" not in self._stubs: + self._stubs["export_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/ExportAgent", + request_serializer=agent.ExportAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["export_agent"] + + @property + def import_agent( + self, + ) -> Callable[[agent.ImportAgentRequest], operations.Operation]: + r"""Return a callable for the import agent method over gRPC. + + Imports the specified agent from a ZIP file. + + Uploads new intents and entity types without deleting the + existing ones. Intents and entity types with the same name are + replaced with the new versions from + [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. + After the import, the imported draft agent will be trained + automatically (unless disabled in agent settings). However, once + the import is done, training may not be completed yet. Please + call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when importing is complete. It only tracks when the + draft agent is updated not when it is done training. + + Returns: + Callable[[~.ImportAgentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "import_agent" not in self._stubs: + self._stubs["import_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/ImportAgent", + request_serializer=agent.ImportAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["import_agent"] + + @property + def restore_agent( + self, + ) -> Callable[[agent.RestoreAgentRequest], operations.Operation]: + r"""Return a callable for the restore agent method over gRPC. + + Restores the specified agent from a ZIP file. + + Replaces the current agent version with a new one. All the + intents and entity types in the older version are deleted. After + the restore, the restored draft agent will be trained + automatically (unless disabled in agent settings). However, once + the restore is done, training may not be completed yet. Please + call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when restoring is complete. It only tracks when the + draft agent is updated not when it is done training. + + Returns: + Callable[[~.RestoreAgentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "restore_agent" not in self._stubs: + self._stubs["restore_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/RestoreAgent", + request_serializer=agent.RestoreAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["restore_agent"] + + @property + def get_validation_result( + self, + ) -> Callable[ + [agent.GetValidationResultRequest], validation_result.ValidationResult + ]: + r"""Return a callable for the get validation result method over gRPC. + + Gets agent validation result. Agent validation is + performed during training time and is updated + automatically when training is completed. + + Returns: + Callable[[~.GetValidationResultRequest], + ~.ValidationResult]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_validation_result" not in self._stubs: + self._stubs["get_validation_result"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/GetValidationResult", + request_serializer=agent.GetValidationResultRequest.serialize, + response_deserializer=validation_result.ValidationResult.deserialize, + ) + return self._stubs["get_validation_result"] + + +__all__ = ("AgentsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2/services/agents/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2/services/agents/transports/grpc_asyncio.py new file mode 100644 index 000000000..4a6dbb1f5 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/agents/transports/grpc_asyncio.py @@ -0,0 +1,537 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import operations_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2.types import agent +from google.cloud.dialogflow_v2.types import agent as gcd_agent +from google.cloud.dialogflow_v2.types import validation_result +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import AgentsTransport, DEFAULT_CLIENT_INFO +from .grpc import AgentsGrpcTransport + + +class AgentsGrpcAsyncIOTransport(AgentsTransport): + """gRPC AsyncIO backend transport for Agents. + + Service for managing [Agents][google.cloud.dialogflow.v2.Agent]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def get_agent(self) -> Callable[[agent.GetAgentRequest], Awaitable[agent.Agent]]: + r"""Return a callable for the get agent method over gRPC. + + Retrieves the specified agent. + + Returns: + Callable[[~.GetAgentRequest], + Awaitable[~.Agent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_agent" not in self._stubs: + self._stubs["get_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/GetAgent", + request_serializer=agent.GetAgentRequest.serialize, + response_deserializer=agent.Agent.deserialize, + ) + return self._stubs["get_agent"] + + @property + def set_agent( + self, + ) -> Callable[[gcd_agent.SetAgentRequest], Awaitable[gcd_agent.Agent]]: + r"""Return a callable for the set agent method over gRPC. + + Creates/updates the specified agent. + + Returns: + Callable[[~.SetAgentRequest], + Awaitable[~.Agent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "set_agent" not in self._stubs: + self._stubs["set_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/SetAgent", + request_serializer=gcd_agent.SetAgentRequest.serialize, + response_deserializer=gcd_agent.Agent.deserialize, + ) + return self._stubs["set_agent"] + + @property + def delete_agent( + self, + ) -> Callable[[agent.DeleteAgentRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete agent method over gRPC. + + Deletes the specified agent. + + Returns: + Callable[[~.DeleteAgentRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_agent" not in self._stubs: + self._stubs["delete_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/DeleteAgent", + request_serializer=agent.DeleteAgentRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_agent"] + + @property + def search_agents( + self, + ) -> Callable[[agent.SearchAgentsRequest], Awaitable[agent.SearchAgentsResponse]]: + r"""Return a callable for the search agents method over gRPC. + + Returns the list of agents. + + Since there is at most one conversational agent per project, + this method is useful primarily for listing all agents across + projects the caller has access to. One can achieve that with a + wildcard project collection id "-". Refer to `List + Sub-Collections `__. + + Returns: + Callable[[~.SearchAgentsRequest], + Awaitable[~.SearchAgentsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "search_agents" not in self._stubs: + self._stubs["search_agents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/SearchAgents", + request_serializer=agent.SearchAgentsRequest.serialize, + response_deserializer=agent.SearchAgentsResponse.deserialize, + ) + return self._stubs["search_agents"] + + @property + def train_agent( + self, + ) -> Callable[[agent.TrainAgentRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the train agent method over gRPC. + + Trains the specified agent. + + Operation + + Returns: + Callable[[~.TrainAgentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "train_agent" not in self._stubs: + self._stubs["train_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/TrainAgent", + request_serializer=agent.TrainAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["train_agent"] + + @property + def export_agent( + self, + ) -> Callable[[agent.ExportAgentRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the export agent method over gRPC. + + Exports the specified agent to a ZIP file. + + Operation + + Returns: + Callable[[~.ExportAgentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "export_agent" not in self._stubs: + self._stubs["export_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/ExportAgent", + request_serializer=agent.ExportAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["export_agent"] + + @property + def import_agent( + self, + ) -> Callable[[agent.ImportAgentRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the import agent method over gRPC. + + Imports the specified agent from a ZIP file. + + Uploads new intents and entity types without deleting the + existing ones. Intents and entity types with the same name are + replaced with the new versions from + [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. + After the import, the imported draft agent will be trained + automatically (unless disabled in agent settings). However, once + the import is done, training may not be completed yet. Please + call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when importing is complete. It only tracks when the + draft agent is updated not when it is done training. + + Returns: + Callable[[~.ImportAgentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "import_agent" not in self._stubs: + self._stubs["import_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/ImportAgent", + request_serializer=agent.ImportAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["import_agent"] + + @property + def restore_agent( + self, + ) -> Callable[[agent.RestoreAgentRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the restore agent method over gRPC. + + Restores the specified agent from a ZIP file. + + Replaces the current agent version with a new one. All the + intents and entity types in the older version are deleted. After + the restore, the restored draft agent will be trained + automatically (unless disabled in agent settings). However, once + the restore is done, training may not be completed yet. Please + call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when restoring is complete. It only tracks when the + draft agent is updated not when it is done training. + + Returns: + Callable[[~.RestoreAgentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "restore_agent" not in self._stubs: + self._stubs["restore_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/RestoreAgent", + request_serializer=agent.RestoreAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["restore_agent"] + + @property + def get_validation_result( + self, + ) -> Callable[ + [agent.GetValidationResultRequest], + Awaitable[validation_result.ValidationResult], + ]: + r"""Return a callable for the get validation result method over gRPC. + + Gets agent validation result. Agent validation is + performed during training time and is updated + automatically when training is completed. + + Returns: + Callable[[~.GetValidationResultRequest], + Awaitable[~.ValidationResult]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_validation_result" not in self._stubs: + self._stubs["get_validation_result"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Agents/GetValidationResult", + request_serializer=agent.GetValidationResultRequest.serialize, + response_deserializer=validation_result.ValidationResult.deserialize, + ) + return self._stubs["get_validation_result"] + + +__all__ = ("AgentsGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2/services/contexts/__init__.py b/google/cloud/dialogflow_v2/services/contexts/__init__.py new file mode 100644 index 000000000..56b19b0f2 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/contexts/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import ContextsClient +from .async_client import ContextsAsyncClient + +__all__ = ( + "ContextsClient", + "ContextsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2/services/contexts/async_client.py b/google/cloud/dialogflow_v2/services/contexts/async_client.py new file mode 100644 index 000000000..decc44459 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/contexts/async_client.py @@ -0,0 +1,671 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2.services.contexts import pagers +from google.cloud.dialogflow_v2.types import context +from google.cloud.dialogflow_v2.types import context as gcd_context +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import ContextsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import ContextsGrpcAsyncIOTransport +from .client import ContextsClient + + +class ContextsAsyncClient: + """Service for managing [Contexts][google.cloud.dialogflow.v2.Context].""" + + _client: ContextsClient + + DEFAULT_ENDPOINT = ContextsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = ContextsClient.DEFAULT_MTLS_ENDPOINT + + context_path = staticmethod(ContextsClient.context_path) + parse_context_path = staticmethod(ContextsClient.parse_context_path) + + common_billing_account_path = staticmethod( + ContextsClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + ContextsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(ContextsClient.common_folder_path) + parse_common_folder_path = staticmethod(ContextsClient.parse_common_folder_path) + + common_organization_path = staticmethod(ContextsClient.common_organization_path) + parse_common_organization_path = staticmethod( + ContextsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(ContextsClient.common_project_path) + parse_common_project_path = staticmethod(ContextsClient.parse_common_project_path) + + common_location_path = staticmethod(ContextsClient.common_location_path) + parse_common_location_path = staticmethod(ContextsClient.parse_common_location_path) + + from_service_account_file = ContextsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> ContextsTransport: + """Return the transport used by the client instance. + + Returns: + ContextsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(ContextsClient).get_transport_class, type(ContextsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, ContextsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the contexts client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.ContextsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = ContextsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_contexts( + self, + request: context.ListContextsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListContextsAsyncPager: + r"""Returns the list of all contexts in the specified + session. + + Args: + request (:class:`~.context.ListContextsRequest`): + The request object. The request message for + [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. + parent (:class:`str`): + Required. The session to list all contexts from. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListContextsAsyncPager: + The response message for + [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = context.ListContextsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_contexts, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.ListContextsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_context( + self, + request: context.GetContextRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> context.Context: + r"""Retrieves the specified context. + + Args: + request (:class:`~.context.GetContextRequest`): + The request object. The request message for + [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext]. + name (:class:`str`): + Required. The name of the context. Format: + ``projects//agent/sessions//contexts/`` + or + ``projects//agent/environments//users//sessions//contexts/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = context.GetContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_context, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_context( + self, + request: gcd_context.CreateContextRequest = None, + *, + parent: str = None, + context: gcd_context.Context = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_context.Context: + r"""Creates a context. + If the specified context already exists, overrides the + context. + + Args: + request (:class:`~.gcd_context.CreateContextRequest`): + The request object. The request message for + [Contexts.CreateContext][google.cloud.dialogflow.v2.Contexts.CreateContext]. + parent (:class:`str`): + Required. The session to create a context for. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + context (:class:`~.gcd_context.Context`): + Required. The context to create. + This corresponds to the ``context`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, context]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_context.CreateContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if context is not None: + request.context = context + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_context, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def update_context( + self, + request: gcd_context.UpdateContextRequest = None, + *, + context: gcd_context.Context = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_context.Context: + r"""Updates the specified context. + + Args: + request (:class:`~.gcd_context.UpdateContextRequest`): + The request object. The request message for + [Contexts.UpdateContext][google.cloud.dialogflow.v2.Contexts.UpdateContext]. + context (:class:`~.gcd_context.Context`): + Required. The context to update. + This corresponds to the ``context`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([context, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_context.UpdateContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if context is not None: + request.context = context + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_context, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("context.name", request.context.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_context( + self, + request: context.DeleteContextRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified context. + + Args: + request (:class:`~.context.DeleteContextRequest`): + The request object. The request message for + [Contexts.DeleteContext][google.cloud.dialogflow.v2.Contexts.DeleteContext]. + name (:class:`str`): + Required. The name of the context to delete. Format: + ``projects//agent/sessions//contexts/`` + or + ``projects//agent/environments//users//sessions//contexts/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = context.DeleteContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_context, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def delete_all_contexts( + self, + request: context.DeleteAllContextsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes all active contexts in the specified session. + + Args: + request (:class:`~.context.DeleteAllContextsRequest`): + The request object. The request message for + [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2.Contexts.DeleteAllContexts]. + parent (:class:`str`): + Required. The name of the session to delete all contexts + from. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = context.DeleteAllContextsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_all_contexts, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("ContextsAsyncClient",) diff --git a/google/cloud/dialogflow_v2/services/contexts/client.py b/google/cloud/dialogflow_v2/services/contexts/client.py new file mode 100644 index 000000000..6bd1fe458 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/contexts/client.py @@ -0,0 +1,874 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2.services.contexts import pagers +from google.cloud.dialogflow_v2.types import context +from google.cloud.dialogflow_v2.types import context as gcd_context +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import ContextsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import ContextsGrpcTransport +from .transports.grpc_asyncio import ContextsGrpcAsyncIOTransport + + +class ContextsClientMeta(type): + """Metaclass for the Contexts client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[ContextsTransport]] + _transport_registry["grpc"] = ContextsGrpcTransport + _transport_registry["grpc_asyncio"] = ContextsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[ContextsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class ContextsClient(metaclass=ContextsClientMeta): + """Service for managing [Contexts][google.cloud.dialogflow.v2.Context].""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> ContextsTransport: + """Return the transport used by the client instance. + + Returns: + ContextsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def context_path(project: str, session: str, context: str,) -> str: + """Return a fully-qualified context string.""" + return "projects/{project}/agent/sessions/{session}/contexts/{context}".format( + project=project, session=session, context=context, + ) + + @staticmethod + def parse_context_path(path: str) -> Dict[str, str]: + """Parse a context path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/contexts/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, ContextsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the contexts client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.ContextsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, ContextsTransport): + # transport is a ContextsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_contexts( + self, + request: context.ListContextsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListContextsPager: + r"""Returns the list of all contexts in the specified + session. + + Args: + request (:class:`~.context.ListContextsRequest`): + The request object. The request message for + [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. + parent (:class:`str`): + Required. The session to list all contexts from. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListContextsPager: + The response message for + [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a context.ListContextsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, context.ListContextsRequest): + request = context.ListContextsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_contexts] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.ListContextsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def get_context( + self, + request: context.GetContextRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> context.Context: + r"""Retrieves the specified context. + + Args: + request (:class:`~.context.GetContextRequest`): + The request object. The request message for + [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext]. + name (:class:`str`): + Required. The name of the context. Format: + ``projects//agent/sessions//contexts/`` + or + ``projects//agent/environments//users//sessions//contexts/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a context.GetContextRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, context.GetContextRequest): + request = context.GetContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_context] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_context( + self, + request: gcd_context.CreateContextRequest = None, + *, + parent: str = None, + context: gcd_context.Context = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_context.Context: + r"""Creates a context. + If the specified context already exists, overrides the + context. + + Args: + request (:class:`~.gcd_context.CreateContextRequest`): + The request object. The request message for + [Contexts.CreateContext][google.cloud.dialogflow.v2.Contexts.CreateContext]. + parent (:class:`str`): + Required. The session to create a context for. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + context (:class:`~.gcd_context.Context`): + Required. The context to create. + This corresponds to the ``context`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, context]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_context.CreateContextRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_context.CreateContextRequest): + request = gcd_context.CreateContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if context is not None: + request.context = context + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_context] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def update_context( + self, + request: gcd_context.UpdateContextRequest = None, + *, + context: gcd_context.Context = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_context.Context: + r"""Updates the specified context. + + Args: + request (:class:`~.gcd_context.UpdateContextRequest`): + The request object. The request message for + [Contexts.UpdateContext][google.cloud.dialogflow.v2.Contexts.UpdateContext]. + context (:class:`~.gcd_context.Context`): + Required. The context to update. + This corresponds to the ``context`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([context, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_context.UpdateContextRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_context.UpdateContextRequest): + request = gcd_context.UpdateContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if context is not None: + request.context = context + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_context] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("context.name", request.context.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_context( + self, + request: context.DeleteContextRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified context. + + Args: + request (:class:`~.context.DeleteContextRequest`): + The request object. The request message for + [Contexts.DeleteContext][google.cloud.dialogflow.v2.Contexts.DeleteContext]. + name (:class:`str`): + Required. The name of the context to delete. Format: + ``projects//agent/sessions//contexts/`` + or + ``projects//agent/environments//users//sessions//contexts/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a context.DeleteContextRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, context.DeleteContextRequest): + request = context.DeleteContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_context] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def delete_all_contexts( + self, + request: context.DeleteAllContextsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes all active contexts in the specified session. + + Args: + request (:class:`~.context.DeleteAllContextsRequest`): + The request object. The request message for + [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2.Contexts.DeleteAllContexts]. + parent (:class:`str`): + Required. The name of the session to delete all contexts + from. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a context.DeleteAllContextsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, context.DeleteAllContextsRequest): + request = context.DeleteAllContextsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_all_contexts] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("ContextsClient",) diff --git a/google/cloud/dialogflow_v2/services/contexts/pagers.py b/google/cloud/dialogflow_v2/services/contexts/pagers.py new file mode 100644 index 000000000..93b4e65e1 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/contexts/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2.types import context + + +class ListContextsPager: + """A pager for iterating through ``list_contexts`` requests. + + This class thinly wraps an initial + :class:`~.context.ListContextsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``contexts`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListContexts`` requests and continue to iterate + through the ``contexts`` field on the + corresponding responses. + + All the usual :class:`~.context.ListContextsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., context.ListContextsResponse], + request: context.ListContextsRequest, + response: context.ListContextsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.context.ListContextsRequest`): + The initial request object. + response (:class:`~.context.ListContextsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = context.ListContextsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[context.ListContextsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[context.Context]: + for page in self.pages: + yield from page.contexts + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListContextsAsyncPager: + """A pager for iterating through ``list_contexts`` requests. + + This class thinly wraps an initial + :class:`~.context.ListContextsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``contexts`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListContexts`` requests and continue to iterate + through the ``contexts`` field on the + corresponding responses. + + All the usual :class:`~.context.ListContextsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[context.ListContextsResponse]], + request: context.ListContextsRequest, + response: context.ListContextsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.context.ListContextsRequest`): + The initial request object. + response (:class:`~.context.ListContextsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = context.ListContextsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[context.ListContextsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[context.Context]: + async def async_generator(): + async for page in self.pages: + for response in page.contexts: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2/services/contexts/transports/__init__.py b/google/cloud/dialogflow_v2/services/contexts/transports/__init__.py new file mode 100644 index 000000000..845f386d7 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/contexts/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import ContextsTransport +from .grpc import ContextsGrpcTransport +from .grpc_asyncio import ContextsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[ContextsTransport]] +_transport_registry["grpc"] = ContextsGrpcTransport +_transport_registry["grpc_asyncio"] = ContextsGrpcAsyncIOTransport + + +__all__ = ( + "ContextsTransport", + "ContextsGrpcTransport", + "ContextsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2/services/contexts/transports/base.py b/google/cloud/dialogflow_v2/services/contexts/transports/base.py new file mode 100644 index 000000000..607281545 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/contexts/transports/base.py @@ -0,0 +1,191 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2.types import context +from google.cloud.dialogflow_v2.types import context as gcd_context +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class ContextsTransport(abc.ABC): + """Abstract transport class for Contexts.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_contexts: gapic_v1.method.wrap_method( + self.list_contexts, default_timeout=None, client_info=client_info, + ), + self.get_context: gapic_v1.method.wrap_method( + self.get_context, default_timeout=None, client_info=client_info, + ), + self.create_context: gapic_v1.method.wrap_method( + self.create_context, default_timeout=None, client_info=client_info, + ), + self.update_context: gapic_v1.method.wrap_method( + self.update_context, default_timeout=None, client_info=client_info, + ), + self.delete_context: gapic_v1.method.wrap_method( + self.delete_context, default_timeout=None, client_info=client_info, + ), + self.delete_all_contexts: gapic_v1.method.wrap_method( + self.delete_all_contexts, default_timeout=None, client_info=client_info, + ), + } + + @property + def list_contexts( + self, + ) -> typing.Callable[ + [context.ListContextsRequest], + typing.Union[ + context.ListContextsResponse, typing.Awaitable[context.ListContextsResponse] + ], + ]: + raise NotImplementedError() + + @property + def get_context( + self, + ) -> typing.Callable[ + [context.GetContextRequest], + typing.Union[context.Context, typing.Awaitable[context.Context]], + ]: + raise NotImplementedError() + + @property + def create_context( + self, + ) -> typing.Callable[ + [gcd_context.CreateContextRequest], + typing.Union[gcd_context.Context, typing.Awaitable[gcd_context.Context]], + ]: + raise NotImplementedError() + + @property + def update_context( + self, + ) -> typing.Callable[ + [gcd_context.UpdateContextRequest], + typing.Union[gcd_context.Context, typing.Awaitable[gcd_context.Context]], + ]: + raise NotImplementedError() + + @property + def delete_context( + self, + ) -> typing.Callable[ + [context.DeleteContextRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def delete_all_contexts( + self, + ) -> typing.Callable[ + [context.DeleteAllContextsRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + +__all__ = ("ContextsTransport",) diff --git a/google/cloud/dialogflow_v2/services/contexts/transports/grpc.py b/google/cloud/dialogflow_v2/services/contexts/transports/grpc.py new file mode 100644 index 000000000..d532006d5 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/contexts/transports/grpc.py @@ -0,0 +1,390 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2.types import context +from google.cloud.dialogflow_v2.types import context as gcd_context +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import ContextsTransport, DEFAULT_CLIENT_INFO + + +class ContextsGrpcTransport(ContextsTransport): + """gRPC backend transport for Contexts. + + Service for managing [Contexts][google.cloud.dialogflow.v2.Context]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def list_contexts( + self, + ) -> Callable[[context.ListContextsRequest], context.ListContextsResponse]: + r"""Return a callable for the list contexts method over gRPC. + + Returns the list of all contexts in the specified + session. + + Returns: + Callable[[~.ListContextsRequest], + ~.ListContextsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_contexts" not in self._stubs: + self._stubs["list_contexts"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/ListContexts", + request_serializer=context.ListContextsRequest.serialize, + response_deserializer=context.ListContextsResponse.deserialize, + ) + return self._stubs["list_contexts"] + + @property + def get_context(self) -> Callable[[context.GetContextRequest], context.Context]: + r"""Return a callable for the get context method over gRPC. + + Retrieves the specified context. + + Returns: + Callable[[~.GetContextRequest], + ~.Context]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_context" not in self._stubs: + self._stubs["get_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/GetContext", + request_serializer=context.GetContextRequest.serialize, + response_deserializer=context.Context.deserialize, + ) + return self._stubs["get_context"] + + @property + def create_context( + self, + ) -> Callable[[gcd_context.CreateContextRequest], gcd_context.Context]: + r"""Return a callable for the create context method over gRPC. + + Creates a context. + If the specified context already exists, overrides the + context. + + Returns: + Callable[[~.CreateContextRequest], + ~.Context]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_context" not in self._stubs: + self._stubs["create_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/CreateContext", + request_serializer=gcd_context.CreateContextRequest.serialize, + response_deserializer=gcd_context.Context.deserialize, + ) + return self._stubs["create_context"] + + @property + def update_context( + self, + ) -> Callable[[gcd_context.UpdateContextRequest], gcd_context.Context]: + r"""Return a callable for the update context method over gRPC. + + Updates the specified context. + + Returns: + Callable[[~.UpdateContextRequest], + ~.Context]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_context" not in self._stubs: + self._stubs["update_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/UpdateContext", + request_serializer=gcd_context.UpdateContextRequest.serialize, + response_deserializer=gcd_context.Context.deserialize, + ) + return self._stubs["update_context"] + + @property + def delete_context(self) -> Callable[[context.DeleteContextRequest], empty.Empty]: + r"""Return a callable for the delete context method over gRPC. + + Deletes the specified context. + + Returns: + Callable[[~.DeleteContextRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_context" not in self._stubs: + self._stubs["delete_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/DeleteContext", + request_serializer=context.DeleteContextRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_context"] + + @property + def delete_all_contexts( + self, + ) -> Callable[[context.DeleteAllContextsRequest], empty.Empty]: + r"""Return a callable for the delete all contexts method over gRPC. + + Deletes all active contexts in the specified session. + + Returns: + Callable[[~.DeleteAllContextsRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_all_contexts" not in self._stubs: + self._stubs["delete_all_contexts"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/DeleteAllContexts", + request_serializer=context.DeleteAllContextsRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_all_contexts"] + + +__all__ = ("ContextsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2/services/contexts/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2/services/contexts/transports/grpc_asyncio.py new file mode 100644 index 000000000..d43a60ddb --- /dev/null +++ b/google/cloud/dialogflow_v2/services/contexts/transports/grpc_asyncio.py @@ -0,0 +1,400 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2.types import context +from google.cloud.dialogflow_v2.types import context as gcd_context +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import ContextsTransport, DEFAULT_CLIENT_INFO +from .grpc import ContextsGrpcTransport + + +class ContextsGrpcAsyncIOTransport(ContextsTransport): + """gRPC AsyncIO backend transport for Contexts. + + Service for managing [Contexts][google.cloud.dialogflow.v2.Context]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def list_contexts( + self, + ) -> Callable[ + [context.ListContextsRequest], Awaitable[context.ListContextsResponse] + ]: + r"""Return a callable for the list contexts method over gRPC. + + Returns the list of all contexts in the specified + session. + + Returns: + Callable[[~.ListContextsRequest], + Awaitable[~.ListContextsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_contexts" not in self._stubs: + self._stubs["list_contexts"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/ListContexts", + request_serializer=context.ListContextsRequest.serialize, + response_deserializer=context.ListContextsResponse.deserialize, + ) + return self._stubs["list_contexts"] + + @property + def get_context( + self, + ) -> Callable[[context.GetContextRequest], Awaitable[context.Context]]: + r"""Return a callable for the get context method over gRPC. + + Retrieves the specified context. + + Returns: + Callable[[~.GetContextRequest], + Awaitable[~.Context]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_context" not in self._stubs: + self._stubs["get_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/GetContext", + request_serializer=context.GetContextRequest.serialize, + response_deserializer=context.Context.deserialize, + ) + return self._stubs["get_context"] + + @property + def create_context( + self, + ) -> Callable[[gcd_context.CreateContextRequest], Awaitable[gcd_context.Context]]: + r"""Return a callable for the create context method over gRPC. + + Creates a context. + If the specified context already exists, overrides the + context. + + Returns: + Callable[[~.CreateContextRequest], + Awaitable[~.Context]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_context" not in self._stubs: + self._stubs["create_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/CreateContext", + request_serializer=gcd_context.CreateContextRequest.serialize, + response_deserializer=gcd_context.Context.deserialize, + ) + return self._stubs["create_context"] + + @property + def update_context( + self, + ) -> Callable[[gcd_context.UpdateContextRequest], Awaitable[gcd_context.Context]]: + r"""Return a callable for the update context method over gRPC. + + Updates the specified context. + + Returns: + Callable[[~.UpdateContextRequest], + Awaitable[~.Context]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_context" not in self._stubs: + self._stubs["update_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/UpdateContext", + request_serializer=gcd_context.UpdateContextRequest.serialize, + response_deserializer=gcd_context.Context.deserialize, + ) + return self._stubs["update_context"] + + @property + def delete_context( + self, + ) -> Callable[[context.DeleteContextRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete context method over gRPC. + + Deletes the specified context. + + Returns: + Callable[[~.DeleteContextRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_context" not in self._stubs: + self._stubs["delete_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/DeleteContext", + request_serializer=context.DeleteContextRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_context"] + + @property + def delete_all_contexts( + self, + ) -> Callable[[context.DeleteAllContextsRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete all contexts method over gRPC. + + Deletes all active contexts in the specified session. + + Returns: + Callable[[~.DeleteAllContextsRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_all_contexts" not in self._stubs: + self._stubs["delete_all_contexts"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Contexts/DeleteAllContexts", + request_serializer=context.DeleteAllContextsRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_all_contexts"] + + +__all__ = ("ContextsGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2/services/entity_types/__init__.py b/google/cloud/dialogflow_v2/services/entity_types/__init__.py new file mode 100644 index 000000000..f52849c66 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/entity_types/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import EntityTypesClient +from .async_client import EntityTypesAsyncClient + +__all__ = ( + "EntityTypesClient", + "EntityTypesAsyncClient", +) diff --git a/google/cloud/dialogflow_v2/services/entity_types/async_client.py b/google/cloud/dialogflow_v2/services/entity_types/async_client.py new file mode 100644 index 000000000..ce83f9dec --- /dev/null +++ b/google/cloud/dialogflow_v2/services/entity_types/async_client.py @@ -0,0 +1,1155 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2.services.entity_types import pagers +from google.cloud.dialogflow_v2.types import entity_type +from google.cloud.dialogflow_v2.types import entity_type as gcd_entity_type +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import EntityTypesTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import EntityTypesGrpcAsyncIOTransport +from .client import EntityTypesClient + + +class EntityTypesAsyncClient: + """Service for managing + [EntityTypes][google.cloud.dialogflow.v2.EntityType]. + """ + + _client: EntityTypesClient + + DEFAULT_ENDPOINT = EntityTypesClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = EntityTypesClient.DEFAULT_MTLS_ENDPOINT + + entity_type_path = staticmethod(EntityTypesClient.entity_type_path) + parse_entity_type_path = staticmethod(EntityTypesClient.parse_entity_type_path) + + common_billing_account_path = staticmethod( + EntityTypesClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + EntityTypesClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(EntityTypesClient.common_folder_path) + parse_common_folder_path = staticmethod(EntityTypesClient.parse_common_folder_path) + + common_organization_path = staticmethod(EntityTypesClient.common_organization_path) + parse_common_organization_path = staticmethod( + EntityTypesClient.parse_common_organization_path + ) + + common_project_path = staticmethod(EntityTypesClient.common_project_path) + parse_common_project_path = staticmethod( + EntityTypesClient.parse_common_project_path + ) + + common_location_path = staticmethod(EntityTypesClient.common_location_path) + parse_common_location_path = staticmethod( + EntityTypesClient.parse_common_location_path + ) + + from_service_account_file = EntityTypesClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> EntityTypesTransport: + """Return the transport used by the client instance. + + Returns: + EntityTypesTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(EntityTypesClient).get_transport_class, type(EntityTypesClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, EntityTypesTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the entity types client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.EntityTypesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = EntityTypesClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_entity_types( + self, + request: entity_type.ListEntityTypesRequest = None, + *, + parent: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEntityTypesAsyncPager: + r"""Returns the list of all entity types in the specified + agent. + + Args: + request (:class:`~.entity_type.ListEntityTypesRequest`): + The request object. The request message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. + parent (:class:`str`): + Required. The agent to list all entity types from. + Format: ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListEntityTypesAsyncPager: + The response message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.ListEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_entity_types, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def get_entity_type( + self, + request: entity_type.GetEntityTypeRequest = None, + *, + name: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> entity_type.EntityType: + r"""Retrieves the specified entity type. + + Args: + request (:class:`~.entity_type.GetEntityTypeRequest`): + The request object. The request message for + [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType]. + name (:class:`str`): + Required. The name of the entity type. Format: + ``projects//agent/entityTypes/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.GetEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_entity_type( + self, + request: gcd_entity_type.CreateEntityTypeRequest = None, + *, + parent: str = None, + entity_type: gcd_entity_type.EntityType = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_entity_type.EntityType: + r"""Creates an entity type in the specified agent. + + Args: + request (:class:`~.gcd_entity_type.CreateEntityTypeRequest`): + The request object. The request message for + [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2.EntityTypes.CreateEntityType]. + parent (:class:`str`): + Required. The agent to create a entity type for. Format: + ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_type (:class:`~.gcd_entity_type.EntityType`): + Required. The entity type to create. + This corresponds to the ``entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_type, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_entity_type.CreateEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if entity_type is not None: + request.entity_type = entity_type + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def update_entity_type( + self, + request: gcd_entity_type.UpdateEntityTypeRequest = None, + *, + entity_type: gcd_entity_type.EntityType = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_entity_type.EntityType: + r"""Updates the specified entity type. + + Args: + request (:class:`~.gcd_entity_type.UpdateEntityTypeRequest`): + The request object. The request message for + [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType]. + entity_type (:class:`~.gcd_entity_type.EntityType`): + Required. The entity type to update. + This corresponds to the ``entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([entity_type, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_entity_type.UpdateEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if entity_type is not None: + request.entity_type = entity_type + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("entity_type.name", request.entity_type.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_entity_type( + self, + request: entity_type.DeleteEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified entity type. + + Args: + request (:class:`~.entity_type.DeleteEntityTypeRequest`): + The request object. The request message for + [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType]. + name (:class:`str`): + Required. The name of the entity type to delete. Format: + ``projects//agent/entityTypes/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.DeleteEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def batch_update_entity_types( + self, + request: entity_type.BatchUpdateEntityTypesRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates/Creates multiple entity types in the specified agent. + + Operation + + Args: + request (:class:`~.entity_type.BatchUpdateEntityTypesRequest`): + The request object. The request message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.entity_type.BatchUpdateEntityTypesResponse``: + The response message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. + + """ + # Create or coerce a protobuf request object. + + request = entity_type.BatchUpdateEntityTypesRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_update_entity_types, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + entity_type.BatchUpdateEntityTypesResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def batch_delete_entity_types( + self, + request: entity_type.BatchDeleteEntityTypesRequest = None, + *, + parent: str = None, + entity_type_names: Sequence[str] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes entity types in the specified agent. + + Operation + + Args: + request (:class:`~.entity_type.BatchDeleteEntityTypesRequest`): + The request object. The request message for + [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes]. + parent (:class:`str`): + Required. The name of the agent to delete all entities + types for. Format: ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_type_names (:class:`Sequence[str]`): + Required. The names entity types to delete. All names + must point to the same agent as ``parent``. + This corresponds to the ``entity_type_names`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_type_names]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.BatchDeleteEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + if entity_type_names: + request.entity_type_names.extend(entity_type_names) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_delete_entity_types, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def batch_create_entities( + self, + request: entity_type.BatchCreateEntitiesRequest = None, + *, + parent: str = None, + entities: Sequence[entity_type.EntityType.Entity] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates multiple new entities in the specified entity type. + + Operation + + Args: + request (:class:`~.entity_type.BatchCreateEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities]. + parent (:class:`str`): + Required. The name of the entity type to create entities + in. Format: + ``projects//agent/entityTypes/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entities (:class:`Sequence[~.entity_type.EntityType.Entity]`): + Required. The entities to create. + This corresponds to the ``entities`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entities, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.BatchCreateEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entities: + request.entities.extend(entities) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_create_entities, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def batch_update_entities( + self, + request: entity_type.BatchUpdateEntitiesRequest = None, + *, + parent: str = None, + entities: Sequence[entity_type.EntityType.Entity] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates or creates multiple entities in the specified entity + type. This method does not affect entities in the entity type + that aren't explicitly specified in the request. + + Operation + + Args: + request (:class:`~.entity_type.BatchUpdateEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities]. + parent (:class:`str`): + Required. The name of the entity type to update or + create entities in. Format: + ``projects//agent/entityTypes/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entities (:class:`Sequence[~.entity_type.EntityType.Entity]`): + Required. The entities to update or + create. + This corresponds to the ``entities`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entities, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.BatchUpdateEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entities: + request.entities.extend(entities) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_update_entities, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def batch_delete_entities( + self, + request: entity_type.BatchDeleteEntitiesRequest = None, + *, + parent: str = None, + entity_values: Sequence[str] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes entities in the specified entity type. + + Operation + + Args: + request (:class:`~.entity_type.BatchDeleteEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities]. + parent (:class:`str`): + Required. The name of the entity type to delete entries + for. Format: + ``projects//agent/entityTypes/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_values (:class:`Sequence[str]`): + Required. The reference ``values`` of the entities to + delete. Note that these are not fully-qualified names, + i.e. they don't start with ``projects/``. + This corresponds to the ``entity_values`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_values, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.BatchDeleteEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entity_values: + request.entity_values.extend(entity_values) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_delete_entities, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("EntityTypesAsyncClient",) diff --git a/google/cloud/dialogflow_v2/services/entity_types/client.py b/google/cloud/dialogflow_v2/services/entity_types/client.py new file mode 100644 index 000000000..f6e26a181 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/entity_types/client.py @@ -0,0 +1,1361 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2.services.entity_types import pagers +from google.cloud.dialogflow_v2.types import entity_type +from google.cloud.dialogflow_v2.types import entity_type as gcd_entity_type +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import EntityTypesTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import EntityTypesGrpcTransport +from .transports.grpc_asyncio import EntityTypesGrpcAsyncIOTransport + + +class EntityTypesClientMeta(type): + """Metaclass for the EntityTypes client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[EntityTypesTransport]] + _transport_registry["grpc"] = EntityTypesGrpcTransport + _transport_registry["grpc_asyncio"] = EntityTypesGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[EntityTypesTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class EntityTypesClient(metaclass=EntityTypesClientMeta): + """Service for managing + [EntityTypes][google.cloud.dialogflow.v2.EntityType]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> EntityTypesTransport: + """Return the transport used by the client instance. + + Returns: + EntityTypesTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def entity_type_path(project: str, entity_type: str,) -> str: + """Return a fully-qualified entity_type string.""" + return "projects/{project}/agent/entityTypes/{entity_type}".format( + project=project, entity_type=entity_type, + ) + + @staticmethod + def parse_entity_type_path(path: str) -> Dict[str, str]: + """Parse a entity_type path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/entityTypes/(?P.+?)$", path + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, EntityTypesTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the entity types client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.EntityTypesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, EntityTypesTransport): + # transport is a EntityTypesTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_entity_types( + self, + request: entity_type.ListEntityTypesRequest = None, + *, + parent: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEntityTypesPager: + r"""Returns the list of all entity types in the specified + agent. + + Args: + request (:class:`~.entity_type.ListEntityTypesRequest`): + The request object. The request message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. + parent (:class:`str`): + Required. The agent to list all entity types from. + Format: ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListEntityTypesPager: + The response message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.ListEntityTypesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.ListEntityTypesRequest): + request = entity_type.ListEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_entity_types] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def get_entity_type( + self, + request: entity_type.GetEntityTypeRequest = None, + *, + name: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> entity_type.EntityType: + r"""Retrieves the specified entity type. + + Args: + request (:class:`~.entity_type.GetEntityTypeRequest`): + The request object. The request message for + [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType]. + name (:class:`str`): + Required. The name of the entity type. Format: + ``projects//agent/entityTypes/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.GetEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.GetEntityTypeRequest): + request = entity_type.GetEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_entity_type] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_entity_type( + self, + request: gcd_entity_type.CreateEntityTypeRequest = None, + *, + parent: str = None, + entity_type: gcd_entity_type.EntityType = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_entity_type.EntityType: + r"""Creates an entity type in the specified agent. + + Args: + request (:class:`~.gcd_entity_type.CreateEntityTypeRequest`): + The request object. The request message for + [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2.EntityTypes.CreateEntityType]. + parent (:class:`str`): + Required. The agent to create a entity type for. Format: + ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_type (:class:`~.gcd_entity_type.EntityType`): + Required. The entity type to create. + This corresponds to the ``entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_type, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_entity_type.CreateEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_entity_type.CreateEntityTypeRequest): + request = gcd_entity_type.CreateEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if entity_type is not None: + request.entity_type = entity_type + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_entity_type] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def update_entity_type( + self, + request: gcd_entity_type.UpdateEntityTypeRequest = None, + *, + entity_type: gcd_entity_type.EntityType = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_entity_type.EntityType: + r"""Updates the specified entity type. + + Args: + request (:class:`~.gcd_entity_type.UpdateEntityTypeRequest`): + The request object. The request message for + [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType]. + entity_type (:class:`~.gcd_entity_type.EntityType`): + Required. The entity type to update. + This corresponds to the ``entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([entity_type, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_entity_type.UpdateEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_entity_type.UpdateEntityTypeRequest): + request = gcd_entity_type.UpdateEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if entity_type is not None: + request.entity_type = entity_type + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_entity_type] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("entity_type.name", request.entity_type.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_entity_type( + self, + request: entity_type.DeleteEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified entity type. + + Args: + request (:class:`~.entity_type.DeleteEntityTypeRequest`): + The request object. The request message for + [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType]. + name (:class:`str`): + Required. The name of the entity type to delete. Format: + ``projects//agent/entityTypes/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.DeleteEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.DeleteEntityTypeRequest): + request = entity_type.DeleteEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_entity_type] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def batch_update_entity_types( + self, + request: entity_type.BatchUpdateEntityTypesRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates/Creates multiple entity types in the specified agent. + + Operation + + Args: + request (:class:`~.entity_type.BatchUpdateEntityTypesRequest`): + The request object. The request message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.entity_type.BatchUpdateEntityTypesResponse``: + The response message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.BatchUpdateEntityTypesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.BatchUpdateEntityTypesRequest): + request = entity_type.BatchUpdateEntityTypesRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.batch_update_entity_types + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + entity_type.BatchUpdateEntityTypesResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def batch_delete_entity_types( + self, + request: entity_type.BatchDeleteEntityTypesRequest = None, + *, + parent: str = None, + entity_type_names: Sequence[str] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes entity types in the specified agent. + + Operation + + Args: + request (:class:`~.entity_type.BatchDeleteEntityTypesRequest`): + The request object. The request message for + [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes]. + parent (:class:`str`): + Required. The name of the agent to delete all entities + types for. Format: ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_type_names (:class:`Sequence[str]`): + Required. The names entity types to delete. All names + must point to the same agent as ``parent``. + This corresponds to the ``entity_type_names`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_type_names]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.BatchDeleteEntityTypesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.BatchDeleteEntityTypesRequest): + request = entity_type.BatchDeleteEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + if entity_type_names: + request.entity_type_names.extend(entity_type_names) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.batch_delete_entity_types + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def batch_create_entities( + self, + request: entity_type.BatchCreateEntitiesRequest = None, + *, + parent: str = None, + entities: Sequence[entity_type.EntityType.Entity] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates multiple new entities in the specified entity type. + + Operation + + Args: + request (:class:`~.entity_type.BatchCreateEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities]. + parent (:class:`str`): + Required. The name of the entity type to create entities + in. Format: + ``projects//agent/entityTypes/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entities (:class:`Sequence[~.entity_type.EntityType.Entity]`): + Required. The entities to create. + This corresponds to the ``entities`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entities, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.BatchCreateEntitiesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.BatchCreateEntitiesRequest): + request = entity_type.BatchCreateEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entities: + request.entities.extend(entities) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_create_entities] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def batch_update_entities( + self, + request: entity_type.BatchUpdateEntitiesRequest = None, + *, + parent: str = None, + entities: Sequence[entity_type.EntityType.Entity] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates or creates multiple entities in the specified entity + type. This method does not affect entities in the entity type + that aren't explicitly specified in the request. + + Operation + + Args: + request (:class:`~.entity_type.BatchUpdateEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities]. + parent (:class:`str`): + Required. The name of the entity type to update or + create entities in. Format: + ``projects//agent/entityTypes/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entities (:class:`Sequence[~.entity_type.EntityType.Entity]`): + Required. The entities to update or + create. + This corresponds to the ``entities`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entities, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.BatchUpdateEntitiesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.BatchUpdateEntitiesRequest): + request = entity_type.BatchUpdateEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entities: + request.entities.extend(entities) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_update_entities] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def batch_delete_entities( + self, + request: entity_type.BatchDeleteEntitiesRequest = None, + *, + parent: str = None, + entity_values: Sequence[str] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes entities in the specified entity type. + + Operation + + Args: + request (:class:`~.entity_type.BatchDeleteEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities]. + parent (:class:`str`): + Required. The name of the entity type to delete entries + for. Format: + ``projects//agent/entityTypes/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_values (:class:`Sequence[str]`): + Required. The reference ``values`` of the entities to + delete. Note that these are not fully-qualified names, + i.e. they don't start with ``projects/``. + This corresponds to the ``entity_values`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_values, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.BatchDeleteEntitiesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.BatchDeleteEntitiesRequest): + request = entity_type.BatchDeleteEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entity_values: + request.entity_values.extend(entity_values) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_delete_entities] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("EntityTypesClient",) diff --git a/google/cloud/dialogflow_v2/services/entity_types/pagers.py b/google/cloud/dialogflow_v2/services/entity_types/pagers.py new file mode 100644 index 000000000..b0c99ef5d --- /dev/null +++ b/google/cloud/dialogflow_v2/services/entity_types/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2.types import entity_type + + +class ListEntityTypesPager: + """A pager for iterating through ``list_entity_types`` requests. + + This class thinly wraps an initial + :class:`~.entity_type.ListEntityTypesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``entity_types`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListEntityTypes`` requests and continue to iterate + through the ``entity_types`` field on the + corresponding responses. + + All the usual :class:`~.entity_type.ListEntityTypesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., entity_type.ListEntityTypesResponse], + request: entity_type.ListEntityTypesRequest, + response: entity_type.ListEntityTypesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.entity_type.ListEntityTypesRequest`): + The initial request object. + response (:class:`~.entity_type.ListEntityTypesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = entity_type.ListEntityTypesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[entity_type.ListEntityTypesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[entity_type.EntityType]: + for page in self.pages: + yield from page.entity_types + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListEntityTypesAsyncPager: + """A pager for iterating through ``list_entity_types`` requests. + + This class thinly wraps an initial + :class:`~.entity_type.ListEntityTypesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``entity_types`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListEntityTypes`` requests and continue to iterate + through the ``entity_types`` field on the + corresponding responses. + + All the usual :class:`~.entity_type.ListEntityTypesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[entity_type.ListEntityTypesResponse]], + request: entity_type.ListEntityTypesRequest, + response: entity_type.ListEntityTypesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.entity_type.ListEntityTypesRequest`): + The initial request object. + response (:class:`~.entity_type.ListEntityTypesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = entity_type.ListEntityTypesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[entity_type.ListEntityTypesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[entity_type.EntityType]: + async def async_generator(): + async for page in self.pages: + for response in page.entity_types: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2/services/entity_types/transports/__init__.py b/google/cloud/dialogflow_v2/services/entity_types/transports/__init__.py new file mode 100644 index 000000000..bd6250cb0 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/entity_types/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import EntityTypesTransport +from .grpc import EntityTypesGrpcTransport +from .grpc_asyncio import EntityTypesGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[EntityTypesTransport]] +_transport_registry["grpc"] = EntityTypesGrpcTransport +_transport_registry["grpc_asyncio"] = EntityTypesGrpcAsyncIOTransport + + +__all__ = ( + "EntityTypesTransport", + "EntityTypesGrpcTransport", + "EntityTypesGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2/services/entity_types/transports/base.py b/google/cloud/dialogflow_v2/services/entity_types/transports/base.py new file mode 100644 index 000000000..40e713587 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/entity_types/transports/base.py @@ -0,0 +1,261 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2.types import entity_type +from google.cloud.dialogflow_v2.types import entity_type as gcd_entity_type +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class EntityTypesTransport(abc.ABC): + """Abstract transport class for EntityTypes.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + 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.get_entity_type: gapic_v1.method.wrap_method( + 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.update_entity_type: gapic_v1.method.wrap_method( + 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.batch_update_entity_types: gapic_v1.method.wrap_method( + self.batch_update_entity_types, + default_timeout=None, + client_info=client_info, + ), + self.batch_delete_entity_types: gapic_v1.method.wrap_method( + self.batch_delete_entity_types, + default_timeout=None, + client_info=client_info, + ), + self.batch_create_entities: gapic_v1.method.wrap_method( + self.batch_create_entities, + default_timeout=None, + client_info=client_info, + ), + self.batch_update_entities: gapic_v1.method.wrap_method( + self.batch_update_entities, + default_timeout=None, + client_info=client_info, + ), + self.batch_delete_entities: gapic_v1.method.wrap_method( + self.batch_delete_entities, + default_timeout=None, + client_info=client_info, + ), + } + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def list_entity_types( + self, + ) -> typing.Callable[ + [entity_type.ListEntityTypesRequest], + typing.Union[ + entity_type.ListEntityTypesResponse, + typing.Awaitable[entity_type.ListEntityTypesResponse], + ], + ]: + raise NotImplementedError() + + @property + def get_entity_type( + self, + ) -> typing.Callable[ + [entity_type.GetEntityTypeRequest], + typing.Union[entity_type.EntityType, typing.Awaitable[entity_type.EntityType]], + ]: + raise NotImplementedError() + + @property + def create_entity_type( + self, + ) -> typing.Callable[ + [gcd_entity_type.CreateEntityTypeRequest], + typing.Union[ + gcd_entity_type.EntityType, typing.Awaitable[gcd_entity_type.EntityType] + ], + ]: + raise NotImplementedError() + + @property + def update_entity_type( + self, + ) -> typing.Callable[ + [gcd_entity_type.UpdateEntityTypeRequest], + typing.Union[ + gcd_entity_type.EntityType, typing.Awaitable[gcd_entity_type.EntityType] + ], + ]: + raise NotImplementedError() + + @property + def delete_entity_type( + self, + ) -> typing.Callable[ + [entity_type.DeleteEntityTypeRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def batch_update_entity_types( + self, + ) -> typing.Callable[ + [entity_type.BatchUpdateEntityTypesRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def batch_delete_entity_types( + self, + ) -> typing.Callable[ + [entity_type.BatchDeleteEntityTypesRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def batch_create_entities( + self, + ) -> typing.Callable[ + [entity_type.BatchCreateEntitiesRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def batch_update_entities( + self, + ) -> typing.Callable[ + [entity_type.BatchUpdateEntitiesRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def batch_delete_entities( + self, + ) -> typing.Callable[ + [entity_type.BatchDeleteEntitiesRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + +__all__ = ("EntityTypesTransport",) diff --git a/google/cloud/dialogflow_v2/services/entity_types/transports/grpc.py b/google/cloud/dialogflow_v2/services/entity_types/transports/grpc.py new file mode 100644 index 000000000..25a8d0719 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/entity_types/transports/grpc.py @@ -0,0 +1,538 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2.types import entity_type +from google.cloud.dialogflow_v2.types import entity_type as gcd_entity_type +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import EntityTypesTransport, DEFAULT_CLIENT_INFO + + +class EntityTypesGrpcTransport(EntityTypesTransport): + """gRPC backend transport for EntityTypes. + + Service for managing + [EntityTypes][google.cloud.dialogflow.v2.EntityType]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def list_entity_types( + self, + ) -> Callable[ + [entity_type.ListEntityTypesRequest], entity_type.ListEntityTypesResponse + ]: + r"""Return a callable for the list entity types method over gRPC. + + Returns the list of all entity types in the specified + agent. + + Returns: + Callable[[~.ListEntityTypesRequest], + ~.ListEntityTypesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_entity_types" not in self._stubs: + self._stubs["list_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/ListEntityTypes", + request_serializer=entity_type.ListEntityTypesRequest.serialize, + response_deserializer=entity_type.ListEntityTypesResponse.deserialize, + ) + return self._stubs["list_entity_types"] + + @property + def get_entity_type( + self, + ) -> Callable[[entity_type.GetEntityTypeRequest], entity_type.EntityType]: + r"""Return a callable for the get entity type method over gRPC. + + Retrieves the specified entity type. + + Returns: + Callable[[~.GetEntityTypeRequest], + ~.EntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_entity_type" not in self._stubs: + self._stubs["get_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/GetEntityType", + request_serializer=entity_type.GetEntityTypeRequest.serialize, + response_deserializer=entity_type.EntityType.deserialize, + ) + return self._stubs["get_entity_type"] + + @property + def create_entity_type( + self, + ) -> Callable[ + [gcd_entity_type.CreateEntityTypeRequest], gcd_entity_type.EntityType + ]: + r"""Return a callable for the create entity type method over gRPC. + + Creates an entity type in the specified agent. + + Returns: + Callable[[~.CreateEntityTypeRequest], + ~.EntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_entity_type" not in self._stubs: + self._stubs["create_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/CreateEntityType", + request_serializer=gcd_entity_type.CreateEntityTypeRequest.serialize, + response_deserializer=gcd_entity_type.EntityType.deserialize, + ) + return self._stubs["create_entity_type"] + + @property + def update_entity_type( + self, + ) -> Callable[ + [gcd_entity_type.UpdateEntityTypeRequest], gcd_entity_type.EntityType + ]: + r"""Return a callable for the update entity type method over gRPC. + + Updates the specified entity type. + + Returns: + Callable[[~.UpdateEntityTypeRequest], + ~.EntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_entity_type" not in self._stubs: + self._stubs["update_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/UpdateEntityType", + request_serializer=gcd_entity_type.UpdateEntityTypeRequest.serialize, + response_deserializer=gcd_entity_type.EntityType.deserialize, + ) + return self._stubs["update_entity_type"] + + @property + def delete_entity_type( + self, + ) -> Callable[[entity_type.DeleteEntityTypeRequest], empty.Empty]: + r"""Return a callable for the delete entity type method over gRPC. + + Deletes the specified entity type. + + Returns: + Callable[[~.DeleteEntityTypeRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_entity_type" not in self._stubs: + self._stubs["delete_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/DeleteEntityType", + request_serializer=entity_type.DeleteEntityTypeRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_entity_type"] + + @property + def batch_update_entity_types( + self, + ) -> Callable[[entity_type.BatchUpdateEntityTypesRequest], operations.Operation]: + r"""Return a callable for the batch update entity types method over gRPC. + + Updates/Creates multiple entity types in the specified agent. + + Operation + + Returns: + Callable[[~.BatchUpdateEntityTypesRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_entity_types" not in self._stubs: + self._stubs["batch_update_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/BatchUpdateEntityTypes", + request_serializer=entity_type.BatchUpdateEntityTypesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_entity_types"] + + @property + def batch_delete_entity_types( + self, + ) -> Callable[[entity_type.BatchDeleteEntityTypesRequest], operations.Operation]: + r"""Return a callable for the batch delete entity types method over gRPC. + + Deletes entity types in the specified agent. + + Operation + + Returns: + Callable[[~.BatchDeleteEntityTypesRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_entity_types" not in self._stubs: + self._stubs["batch_delete_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/BatchDeleteEntityTypes", + request_serializer=entity_type.BatchDeleteEntityTypesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_entity_types"] + + @property + def batch_create_entities( + self, + ) -> Callable[[entity_type.BatchCreateEntitiesRequest], operations.Operation]: + r"""Return a callable for the batch create entities method over gRPC. + + Creates multiple new entities in the specified entity type. + + Operation + + Returns: + Callable[[~.BatchCreateEntitiesRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_create_entities" not in self._stubs: + self._stubs["batch_create_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/BatchCreateEntities", + request_serializer=entity_type.BatchCreateEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_create_entities"] + + @property + def batch_update_entities( + self, + ) -> Callable[[entity_type.BatchUpdateEntitiesRequest], operations.Operation]: + r"""Return a callable for the batch update entities method over gRPC. + + Updates or creates multiple entities in the specified entity + type. This method does not affect entities in the entity type + that aren't explicitly specified in the request. + + Operation + + Returns: + Callable[[~.BatchUpdateEntitiesRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_entities" not in self._stubs: + self._stubs["batch_update_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/BatchUpdateEntities", + request_serializer=entity_type.BatchUpdateEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_entities"] + + @property + def batch_delete_entities( + self, + ) -> Callable[[entity_type.BatchDeleteEntitiesRequest], operations.Operation]: + r"""Return a callable for the batch delete entities method over gRPC. + + Deletes entities in the specified entity type. + + Operation + + Returns: + Callable[[~.BatchDeleteEntitiesRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_entities" not in self._stubs: + self._stubs["batch_delete_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/BatchDeleteEntities", + request_serializer=entity_type.BatchDeleteEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_entities"] + + +__all__ = ("EntityTypesGrpcTransport",) diff --git a/google/cloud/dialogflow_v2/services/entity_types/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2/services/entity_types/transports/grpc_asyncio.py new file mode 100644 index 000000000..16808175b --- /dev/null +++ b/google/cloud/dialogflow_v2/services/entity_types/transports/grpc_asyncio.py @@ -0,0 +1,555 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import operations_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2.types import entity_type +from google.cloud.dialogflow_v2.types import entity_type as gcd_entity_type +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import EntityTypesTransport, DEFAULT_CLIENT_INFO +from .grpc import EntityTypesGrpcTransport + + +class EntityTypesGrpcAsyncIOTransport(EntityTypesTransport): + """gRPC AsyncIO backend transport for EntityTypes. + + Service for managing + [EntityTypes][google.cloud.dialogflow.v2.EntityType]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def list_entity_types( + self, + ) -> Callable[ + [entity_type.ListEntityTypesRequest], + Awaitable[entity_type.ListEntityTypesResponse], + ]: + r"""Return a callable for the list entity types method over gRPC. + + Returns the list of all entity types in the specified + agent. + + Returns: + Callable[[~.ListEntityTypesRequest], + Awaitable[~.ListEntityTypesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_entity_types" not in self._stubs: + self._stubs["list_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/ListEntityTypes", + request_serializer=entity_type.ListEntityTypesRequest.serialize, + response_deserializer=entity_type.ListEntityTypesResponse.deserialize, + ) + return self._stubs["list_entity_types"] + + @property + def get_entity_type( + self, + ) -> Callable[ + [entity_type.GetEntityTypeRequest], Awaitable[entity_type.EntityType] + ]: + r"""Return a callable for the get entity type method over gRPC. + + Retrieves the specified entity type. + + Returns: + Callable[[~.GetEntityTypeRequest], + Awaitable[~.EntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_entity_type" not in self._stubs: + self._stubs["get_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/GetEntityType", + request_serializer=entity_type.GetEntityTypeRequest.serialize, + response_deserializer=entity_type.EntityType.deserialize, + ) + return self._stubs["get_entity_type"] + + @property + def create_entity_type( + self, + ) -> Callable[ + [gcd_entity_type.CreateEntityTypeRequest], Awaitable[gcd_entity_type.EntityType] + ]: + r"""Return a callable for the create entity type method over gRPC. + + Creates an entity type in the specified agent. + + Returns: + Callable[[~.CreateEntityTypeRequest], + Awaitable[~.EntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_entity_type" not in self._stubs: + self._stubs["create_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/CreateEntityType", + request_serializer=gcd_entity_type.CreateEntityTypeRequest.serialize, + response_deserializer=gcd_entity_type.EntityType.deserialize, + ) + return self._stubs["create_entity_type"] + + @property + def update_entity_type( + self, + ) -> Callable[ + [gcd_entity_type.UpdateEntityTypeRequest], Awaitable[gcd_entity_type.EntityType] + ]: + r"""Return a callable for the update entity type method over gRPC. + + Updates the specified entity type. + + Returns: + Callable[[~.UpdateEntityTypeRequest], + Awaitable[~.EntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_entity_type" not in self._stubs: + self._stubs["update_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/UpdateEntityType", + request_serializer=gcd_entity_type.UpdateEntityTypeRequest.serialize, + response_deserializer=gcd_entity_type.EntityType.deserialize, + ) + return self._stubs["update_entity_type"] + + @property + def delete_entity_type( + self, + ) -> Callable[[entity_type.DeleteEntityTypeRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete entity type method over gRPC. + + Deletes the specified entity type. + + Returns: + Callable[[~.DeleteEntityTypeRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_entity_type" not in self._stubs: + self._stubs["delete_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/DeleteEntityType", + request_serializer=entity_type.DeleteEntityTypeRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_entity_type"] + + @property + def batch_update_entity_types( + self, + ) -> Callable[ + [entity_type.BatchUpdateEntityTypesRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch update entity types method over gRPC. + + Updates/Creates multiple entity types in the specified agent. + + Operation + + Returns: + Callable[[~.BatchUpdateEntityTypesRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_entity_types" not in self._stubs: + self._stubs["batch_update_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/BatchUpdateEntityTypes", + request_serializer=entity_type.BatchUpdateEntityTypesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_entity_types"] + + @property + def batch_delete_entity_types( + self, + ) -> Callable[ + [entity_type.BatchDeleteEntityTypesRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch delete entity types method over gRPC. + + Deletes entity types in the specified agent. + + Operation + + Returns: + Callable[[~.BatchDeleteEntityTypesRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_entity_types" not in self._stubs: + self._stubs["batch_delete_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/BatchDeleteEntityTypes", + request_serializer=entity_type.BatchDeleteEntityTypesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_entity_types"] + + @property + def batch_create_entities( + self, + ) -> Callable[ + [entity_type.BatchCreateEntitiesRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch create entities method over gRPC. + + Creates multiple new entities in the specified entity type. + + Operation + + Returns: + Callable[[~.BatchCreateEntitiesRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_create_entities" not in self._stubs: + self._stubs["batch_create_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/BatchCreateEntities", + request_serializer=entity_type.BatchCreateEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_create_entities"] + + @property + def batch_update_entities( + self, + ) -> Callable[ + [entity_type.BatchUpdateEntitiesRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch update entities method over gRPC. + + Updates or creates multiple entities in the specified entity + type. This method does not affect entities in the entity type + that aren't explicitly specified in the request. + + Operation + + Returns: + Callable[[~.BatchUpdateEntitiesRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_entities" not in self._stubs: + self._stubs["batch_update_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/BatchUpdateEntities", + request_serializer=entity_type.BatchUpdateEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_entities"] + + @property + def batch_delete_entities( + self, + ) -> Callable[ + [entity_type.BatchDeleteEntitiesRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch delete entities method over gRPC. + + Deletes entities in the specified entity type. + + Operation + + Returns: + Callable[[~.BatchDeleteEntitiesRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_entities" not in self._stubs: + self._stubs["batch_delete_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.EntityTypes/BatchDeleteEntities", + request_serializer=entity_type.BatchDeleteEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_entities"] + + +__all__ = ("EntityTypesGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2/services/environments/__init__.py b/google/cloud/dialogflow_v2/services/environments/__init__.py new file mode 100644 index 000000000..a67f2316d --- /dev/null +++ b/google/cloud/dialogflow_v2/services/environments/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import EnvironmentsClient +from .async_client import EnvironmentsAsyncClient + +__all__ = ( + "EnvironmentsClient", + "EnvironmentsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2/services/environments/async_client.py b/google/cloud/dialogflow_v2/services/environments/async_client.py new file mode 100644 index 000000000..3cb2f6e24 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/environments/async_client.py @@ -0,0 +1,213 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2.services.environments import pagers +from google.cloud.dialogflow_v2.types import environment + +from .transports.base import EnvironmentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import EnvironmentsGrpcAsyncIOTransport +from .client import EnvironmentsClient + + +class EnvironmentsAsyncClient: + """Service for managing + [Environments][google.cloud.dialogflow.v2.Environment]. + """ + + _client: EnvironmentsClient + + DEFAULT_ENDPOINT = EnvironmentsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = EnvironmentsClient.DEFAULT_MTLS_ENDPOINT + + environment_path = staticmethod(EnvironmentsClient.environment_path) + parse_environment_path = staticmethod(EnvironmentsClient.parse_environment_path) + + common_billing_account_path = staticmethod( + EnvironmentsClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + EnvironmentsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(EnvironmentsClient.common_folder_path) + parse_common_folder_path = staticmethod(EnvironmentsClient.parse_common_folder_path) + + common_organization_path = staticmethod(EnvironmentsClient.common_organization_path) + parse_common_organization_path = staticmethod( + EnvironmentsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(EnvironmentsClient.common_project_path) + parse_common_project_path = staticmethod( + EnvironmentsClient.parse_common_project_path + ) + + common_location_path = staticmethod(EnvironmentsClient.common_location_path) + parse_common_location_path = staticmethod( + EnvironmentsClient.parse_common_location_path + ) + + from_service_account_file = EnvironmentsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> EnvironmentsTransport: + """Return the transport used by the client instance. + + Returns: + EnvironmentsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(EnvironmentsClient).get_transport_class, type(EnvironmentsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, EnvironmentsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the environments client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.EnvironmentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = EnvironmentsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_environments( + self, + request: environment.ListEnvironmentsRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEnvironmentsAsyncPager: + r"""Returns the list of all non-draft environments of the + specified agent. + + Args: + request (:class:`~.environment.ListEnvironmentsRequest`): + The request object. The request message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListEnvironmentsAsyncPager: + The response message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + + request = environment.ListEnvironmentsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_environments, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("EnvironmentsAsyncClient",) diff --git a/google/cloud/dialogflow_v2/services/environments/client.py b/google/cloud/dialogflow_v2/services/environments/client.py new file mode 100644 index 000000000..ce56d0729 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/environments/client.py @@ -0,0 +1,406 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2.services.environments import pagers +from google.cloud.dialogflow_v2.types import environment + +from .transports.base import EnvironmentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import EnvironmentsGrpcTransport +from .transports.grpc_asyncio import EnvironmentsGrpcAsyncIOTransport + + +class EnvironmentsClientMeta(type): + """Metaclass for the Environments client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[EnvironmentsTransport]] + _transport_registry["grpc"] = EnvironmentsGrpcTransport + _transport_registry["grpc_asyncio"] = EnvironmentsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[EnvironmentsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class EnvironmentsClient(metaclass=EnvironmentsClientMeta): + """Service for managing + [Environments][google.cloud.dialogflow.v2.Environment]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> EnvironmentsTransport: + """Return the transport used by the client instance. + + Returns: + EnvironmentsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def environment_path(project: str, environment: str,) -> str: + """Return a fully-qualified environment string.""" + return "projects/{project}/agent/environments/{environment}".format( + project=project, environment=environment, + ) + + @staticmethod + def parse_environment_path(path: str) -> Dict[str, str]: + """Parse a environment path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/environments/(?P.+?)$", path + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, EnvironmentsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the environments client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.EnvironmentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, EnvironmentsTransport): + # transport is a EnvironmentsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_environments( + self, + request: environment.ListEnvironmentsRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEnvironmentsPager: + r"""Returns the list of all non-draft environments of the + specified agent. + + Args: + request (:class:`~.environment.ListEnvironmentsRequest`): + The request object. The request message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListEnvironmentsPager: + The response message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a environment.ListEnvironmentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, environment.ListEnvironmentsRequest): + request = environment.ListEnvironmentsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_environments] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("EnvironmentsClient",) diff --git a/google/cloud/dialogflow_v2/services/environments/pagers.py b/google/cloud/dialogflow_v2/services/environments/pagers.py new file mode 100644 index 000000000..095287104 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/environments/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2.types import environment + + +class ListEnvironmentsPager: + """A pager for iterating through ``list_environments`` requests. + + This class thinly wraps an initial + :class:`~.environment.ListEnvironmentsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``environments`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListEnvironments`` requests and continue to iterate + through the ``environments`` field on the + corresponding responses. + + All the usual :class:`~.environment.ListEnvironmentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., environment.ListEnvironmentsResponse], + request: environment.ListEnvironmentsRequest, + response: environment.ListEnvironmentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.environment.ListEnvironmentsRequest`): + The initial request object. + response (:class:`~.environment.ListEnvironmentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = environment.ListEnvironmentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[environment.ListEnvironmentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[environment.Environment]: + for page in self.pages: + yield from page.environments + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListEnvironmentsAsyncPager: + """A pager for iterating through ``list_environments`` requests. + + This class thinly wraps an initial + :class:`~.environment.ListEnvironmentsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``environments`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListEnvironments`` requests and continue to iterate + through the ``environments`` field on the + corresponding responses. + + All the usual :class:`~.environment.ListEnvironmentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[environment.ListEnvironmentsResponse]], + request: environment.ListEnvironmentsRequest, + response: environment.ListEnvironmentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.environment.ListEnvironmentsRequest`): + The initial request object. + response (:class:`~.environment.ListEnvironmentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = environment.ListEnvironmentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[environment.ListEnvironmentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[environment.Environment]: + async def async_generator(): + async for page in self.pages: + for response in page.environments: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2/services/environments/transports/__init__.py b/google/cloud/dialogflow_v2/services/environments/transports/__init__.py new file mode 100644 index 000000000..14f04446c --- /dev/null +++ b/google/cloud/dialogflow_v2/services/environments/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import EnvironmentsTransport +from .grpc import EnvironmentsGrpcTransport +from .grpc_asyncio import EnvironmentsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[EnvironmentsTransport]] +_transport_registry["grpc"] = EnvironmentsGrpcTransport +_transport_registry["grpc_asyncio"] = EnvironmentsGrpcAsyncIOTransport + + +__all__ = ( + "EnvironmentsTransport", + "EnvironmentsGrpcTransport", + "EnvironmentsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2/services/environments/transports/base.py b/google/cloud/dialogflow_v2/services/environments/transports/base.py new file mode 100644 index 000000000..3f074dc7f --- /dev/null +++ b/google/cloud/dialogflow_v2/services/environments/transports/base.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2.types import environment + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class EnvironmentsTransport(abc.ABC): + """Abstract transport class for Environments.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + 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, + ), + } + + @property + def list_environments( + self, + ) -> typing.Callable[ + [environment.ListEnvironmentsRequest], + typing.Union[ + environment.ListEnvironmentsResponse, + typing.Awaitable[environment.ListEnvironmentsResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("EnvironmentsTransport",) diff --git a/google/cloud/dialogflow_v2/services/environments/transports/grpc.py b/google/cloud/dialogflow_v2/services/environments/transports/grpc.py new file mode 100644 index 000000000..a3f69508c --- /dev/null +++ b/google/cloud/dialogflow_v2/services/environments/transports/grpc.py @@ -0,0 +1,263 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2.types import environment + +from .base import EnvironmentsTransport, DEFAULT_CLIENT_INFO + + +class EnvironmentsGrpcTransport(EnvironmentsTransport): + """gRPC backend transport for Environments. + + Service for managing + [Environments][google.cloud.dialogflow.v2.Environment]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def list_environments( + self, + ) -> Callable[ + [environment.ListEnvironmentsRequest], environment.ListEnvironmentsResponse + ]: + r"""Return a callable for the list environments method over gRPC. + + Returns the list of all non-draft environments of the + specified agent. + + Returns: + Callable[[~.ListEnvironmentsRequest], + ~.ListEnvironmentsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_environments" not in self._stubs: + self._stubs["list_environments"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Environments/ListEnvironments", + request_serializer=environment.ListEnvironmentsRequest.serialize, + response_deserializer=environment.ListEnvironmentsResponse.deserialize, + ) + return self._stubs["list_environments"] + + +__all__ = ("EnvironmentsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2/services/environments/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2/services/environments/transports/grpc_asyncio.py new file mode 100644 index 000000000..3c2b741aa --- /dev/null +++ b/google/cloud/dialogflow_v2/services/environments/transports/grpc_asyncio.py @@ -0,0 +1,268 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2.types import environment + +from .base import EnvironmentsTransport, DEFAULT_CLIENT_INFO +from .grpc import EnvironmentsGrpcTransport + + +class EnvironmentsGrpcAsyncIOTransport(EnvironmentsTransport): + """gRPC AsyncIO backend transport for Environments. + + Service for managing + [Environments][google.cloud.dialogflow.v2.Environment]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def list_environments( + self, + ) -> Callable[ + [environment.ListEnvironmentsRequest], + Awaitable[environment.ListEnvironmentsResponse], + ]: + r"""Return a callable for the list environments method over gRPC. + + Returns the list of all non-draft environments of the + specified agent. + + Returns: + Callable[[~.ListEnvironmentsRequest], + Awaitable[~.ListEnvironmentsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_environments" not in self._stubs: + self._stubs["list_environments"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Environments/ListEnvironments", + request_serializer=environment.ListEnvironmentsRequest.serialize, + response_deserializer=environment.ListEnvironmentsResponse.deserialize, + ) + return self._stubs["list_environments"] + + +__all__ = ("EnvironmentsGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2/services/intents/__init__.py b/google/cloud/dialogflow_v2/services/intents/__init__.py new file mode 100644 index 000000000..8719a9b64 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/intents/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import IntentsClient +from .async_client import IntentsAsyncClient + +__all__ = ( + "IntentsClient", + "IntentsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2/services/intents/async_client.py b/google/cloud/dialogflow_v2/services/intents/async_client.py new file mode 100644 index 000000000..992bd0222 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/intents/async_client.py @@ -0,0 +1,830 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2.services.intents import pagers +from google.cloud.dialogflow_v2.types import context +from google.cloud.dialogflow_v2.types import intent +from google.cloud.dialogflow_v2.types import intent as gcd_intent +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import IntentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import IntentsGrpcAsyncIOTransport +from .client import IntentsClient + + +class IntentsAsyncClient: + """Service for managing [Intents][google.cloud.dialogflow.v2.Intent].""" + + _client: IntentsClient + + DEFAULT_ENDPOINT = IntentsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = IntentsClient.DEFAULT_MTLS_ENDPOINT + + context_path = staticmethod(IntentsClient.context_path) + parse_context_path = staticmethod(IntentsClient.parse_context_path) + intent_path = staticmethod(IntentsClient.intent_path) + parse_intent_path = staticmethod(IntentsClient.parse_intent_path) + + common_billing_account_path = staticmethod( + IntentsClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + IntentsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(IntentsClient.common_folder_path) + parse_common_folder_path = staticmethod(IntentsClient.parse_common_folder_path) + + common_organization_path = staticmethod(IntentsClient.common_organization_path) + parse_common_organization_path = staticmethod( + IntentsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(IntentsClient.common_project_path) + parse_common_project_path = staticmethod(IntentsClient.parse_common_project_path) + + common_location_path = staticmethod(IntentsClient.common_location_path) + parse_common_location_path = staticmethod(IntentsClient.parse_common_location_path) + + from_service_account_file = IntentsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> IntentsTransport: + """Return the transport used by the client instance. + + Returns: + IntentsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(IntentsClient).get_transport_class, type(IntentsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, IntentsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the intents client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.IntentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = IntentsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_intents( + self, + request: intent.ListIntentsRequest = None, + *, + parent: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListIntentsAsyncPager: + r"""Returns the list of all intents in the specified + agent. + + Args: + request (:class:`~.intent.ListIntentsRequest`): + The request object. The request message for + [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. + parent (:class:`str`): + Required. The agent to list all intents from. Format: + ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListIntentsAsyncPager: + The response message for + [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = intent.ListIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_intents, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def get_intent( + self, + request: intent.GetIntentRequest = None, + *, + name: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> intent.Intent: + r"""Retrieves the specified intent. + + Args: + request (:class:`~.intent.GetIntentRequest`): + The request object. The request message for + [Intents.GetIntent][google.cloud.dialogflow.v2.Intents.GetIntent]. + name (:class:`str`): + Required. The name of the intent. Format: + ``projects//agent/intents/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = intent.GetIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_intent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_intent( + self, + request: gcd_intent.CreateIntentRequest = None, + *, + parent: str = None, + intent: gcd_intent.Intent = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_intent.Intent: + r"""Creates an intent in the specified agent. + + Args: + request (:class:`~.gcd_intent.CreateIntentRequest`): + The request object. The request message for + [Intents.CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent]. + parent (:class:`str`): + Required. The agent to create a intent for. Format: + ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent (:class:`~.gcd_intent.Intent`): + Required. The intent to create. + This corresponds to the ``intent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_intent.CreateIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if intent is not None: + request.intent = intent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_intent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def update_intent( + self, + request: gcd_intent.UpdateIntentRequest = None, + *, + intent: gcd_intent.Intent = None, + language_code: str = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_intent.Intent: + r"""Updates the specified intent. + + Args: + request (:class:`~.gcd_intent.UpdateIntentRequest`): + The request object. The request message for + [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent]. + intent (:class:`~.gcd_intent.Intent`): + Required. The intent to update. + This corresponds to the ``intent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([intent, language_code, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_intent.UpdateIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if intent is not None: + request.intent = intent + if language_code is not None: + request.language_code = language_code + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_intent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("intent.name", request.intent.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_intent( + self, + request: intent.DeleteIntentRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified intent and its direct or + indirect followup intents. + + Args: + request (:class:`~.intent.DeleteIntentRequest`): + The request object. The request message for + [Intents.DeleteIntent][google.cloud.dialogflow.v2.Intents.DeleteIntent]. + name (:class:`str`): + Required. The name of the intent to delete. If this + intent has direct or indirect followup intents, we also + delete them. Format: + ``projects//agent/intents/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = intent.DeleteIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_intent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def batch_update_intents( + self, + request: intent.BatchUpdateIntentsRequest = None, + *, + parent: str = None, + intent_batch_uri: str = None, + intent_batch_inline: intent.IntentBatch = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates/Creates multiple intents in the specified agent. + + Operation + + Args: + request (:class:`~.intent.BatchUpdateIntentsRequest`): + The request object. + parent (:class:`str`): + Required. The name of the agent to update or create + intents in. Format: ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent_batch_uri (:class:`str`): + The URI to a Google Cloud Storage + file containing intents to update or + create. The file format can either be a + serialized proto (of IntentBatch type) + or JSON object. Note: The URI must start + with "gs://". + This corresponds to the ``intent_batch_uri`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent_batch_inline (:class:`~.intent.IntentBatch`): + The collection of intents to update + or create. + This corresponds to the ``intent_batch_inline`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.intent.BatchUpdateIntentsResponse``: The + response message for + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents]. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intent_batch_uri, intent_batch_inline]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = intent.BatchUpdateIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if intent_batch_uri is not None: + request.intent_batch_uri = intent_batch_uri + if intent_batch_inline is not None: + request.intent_batch_inline = intent_batch_inline + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_update_intents, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + intent.BatchUpdateIntentsResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def batch_delete_intents( + self, + request: intent.BatchDeleteIntentsRequest = None, + *, + parent: str = None, + intents: Sequence[intent.Intent] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes intents in the specified agent. + + Operation + + Args: + request (:class:`~.intent.BatchDeleteIntentsRequest`): + The request object. The request message for + [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2.Intents.BatchDeleteIntents]. + parent (:class:`str`): + Required. The name of the agent to delete all entities + types for. Format: ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intents (:class:`Sequence[~.intent.Intent]`): + Required. The collection of intents to delete. Only + intent ``name`` must be filled in. + This corresponds to the ``intents`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intents]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = intent.BatchDeleteIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + if intents: + request.intents.extend(intents) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_delete_intents, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("IntentsAsyncClient",) diff --git a/google/cloud/dialogflow_v2/services/intents/client.py b/google/cloud/dialogflow_v2/services/intents/client.py new file mode 100644 index 000000000..d6d982579 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/intents/client.py @@ -0,0 +1,1045 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2.services.intents import pagers +from google.cloud.dialogflow_v2.types import context +from google.cloud.dialogflow_v2.types import intent +from google.cloud.dialogflow_v2.types import intent as gcd_intent +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import IntentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import IntentsGrpcTransport +from .transports.grpc_asyncio import IntentsGrpcAsyncIOTransport + + +class IntentsClientMeta(type): + """Metaclass for the Intents client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[IntentsTransport]] + _transport_registry["grpc"] = IntentsGrpcTransport + _transport_registry["grpc_asyncio"] = IntentsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[IntentsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class IntentsClient(metaclass=IntentsClientMeta): + """Service for managing [Intents][google.cloud.dialogflow.v2.Intent].""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> IntentsTransport: + """Return the transport used by the client instance. + + Returns: + IntentsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def context_path(project: str, session: str, context: str,) -> str: + """Return a fully-qualified context string.""" + return "projects/{project}/agent/sessions/{session}/contexts/{context}".format( + project=project, session=session, context=context, + ) + + @staticmethod + def parse_context_path(path: str) -> Dict[str, str]: + """Parse a context path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/contexts/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def intent_path(project: str, intent: str,) -> str: + """Return a fully-qualified intent string.""" + return "projects/{project}/agent/intents/{intent}".format( + project=project, intent=intent, + ) + + @staticmethod + def parse_intent_path(path: str) -> Dict[str, str]: + """Parse a intent path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/agent/intents/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, IntentsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the intents client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.IntentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, IntentsTransport): + # transport is a IntentsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_intents( + self, + request: intent.ListIntentsRequest = None, + *, + parent: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListIntentsPager: + r"""Returns the list of all intents in the specified + agent. + + Args: + request (:class:`~.intent.ListIntentsRequest`): + The request object. The request message for + [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. + parent (:class:`str`): + Required. The agent to list all intents from. Format: + ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListIntentsPager: + The response message for + [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a intent.ListIntentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, intent.ListIntentsRequest): + request = intent.ListIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_intents] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def get_intent( + self, + request: intent.GetIntentRequest = None, + *, + name: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> intent.Intent: + r"""Retrieves the specified intent. + + Args: + request (:class:`~.intent.GetIntentRequest`): + The request object. The request message for + [Intents.GetIntent][google.cloud.dialogflow.v2.Intents.GetIntent]. + name (:class:`str`): + Required. The name of the intent. Format: + ``projects//agent/intents/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a intent.GetIntentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, intent.GetIntentRequest): + request = intent.GetIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_intent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_intent( + self, + request: gcd_intent.CreateIntentRequest = None, + *, + parent: str = None, + intent: gcd_intent.Intent = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_intent.Intent: + r"""Creates an intent in the specified agent. + + Args: + request (:class:`~.gcd_intent.CreateIntentRequest`): + The request object. The request message for + [Intents.CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent]. + parent (:class:`str`): + Required. The agent to create a intent for. Format: + ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent (:class:`~.gcd_intent.Intent`): + Required. The intent to create. + This corresponds to the ``intent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_intent.CreateIntentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_intent.CreateIntentRequest): + request = gcd_intent.CreateIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if intent is not None: + request.intent = intent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_intent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def update_intent( + self, + request: gcd_intent.UpdateIntentRequest = None, + *, + intent: gcd_intent.Intent = None, + language_code: str = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_intent.Intent: + r"""Updates the specified intent. + + Args: + request (:class:`~.gcd_intent.UpdateIntentRequest`): + The request object. The request message for + [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent]. + intent (:class:`~.gcd_intent.Intent`): + Required. The intent to update. + This corresponds to the ``intent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([intent, language_code, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_intent.UpdateIntentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_intent.UpdateIntentRequest): + request = gcd_intent.UpdateIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if intent is not None: + request.intent = intent + if language_code is not None: + request.language_code = language_code + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_intent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("intent.name", request.intent.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_intent( + self, + request: intent.DeleteIntentRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified intent and its direct or + indirect followup intents. + + Args: + request (:class:`~.intent.DeleteIntentRequest`): + The request object. The request message for + [Intents.DeleteIntent][google.cloud.dialogflow.v2.Intents.DeleteIntent]. + name (:class:`str`): + Required. The name of the intent to delete. If this + intent has direct or indirect followup intents, we also + delete them. Format: + ``projects//agent/intents/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a intent.DeleteIntentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, intent.DeleteIntentRequest): + request = intent.DeleteIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_intent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def batch_update_intents( + self, + request: intent.BatchUpdateIntentsRequest = None, + *, + parent: str = None, + intent_batch_uri: str = None, + intent_batch_inline: intent.IntentBatch = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates/Creates multiple intents in the specified agent. + + Operation + + Args: + request (:class:`~.intent.BatchUpdateIntentsRequest`): + The request object. + parent (:class:`str`): + Required. The name of the agent to update or create + intents in. Format: ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent_batch_uri (:class:`str`): + The URI to a Google Cloud Storage + file containing intents to update or + create. The file format can either be a + serialized proto (of IntentBatch type) + or JSON object. Note: The URI must start + with "gs://". + This corresponds to the ``intent_batch_uri`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent_batch_inline (:class:`~.intent.IntentBatch`): + The collection of intents to update + or create. + This corresponds to the ``intent_batch_inline`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.intent.BatchUpdateIntentsResponse``: The + response message for + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents]. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intent_batch_uri, intent_batch_inline]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a intent.BatchUpdateIntentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, intent.BatchUpdateIntentsRequest): + request = intent.BatchUpdateIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if intent_batch_uri is not None: + request.intent_batch_uri = intent_batch_uri + if intent_batch_inline is not None: + request.intent_batch_inline = intent_batch_inline + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_update_intents] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + intent.BatchUpdateIntentsResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def batch_delete_intents( + self, + request: intent.BatchDeleteIntentsRequest = None, + *, + parent: str = None, + intents: Sequence[intent.Intent] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes intents in the specified agent. + + Operation + + Args: + request (:class:`~.intent.BatchDeleteIntentsRequest`): + The request object. The request message for + [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2.Intents.BatchDeleteIntents]. + parent (:class:`str`): + Required. The name of the agent to delete all entities + types for. Format: ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intents (:class:`Sequence[~.intent.Intent]`): + Required. The collection of intents to delete. Only + intent ``name`` must be filled in. + This corresponds to the ``intents`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intents]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a intent.BatchDeleteIntentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, intent.BatchDeleteIntentsRequest): + request = intent.BatchDeleteIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + if intents: + request.intents.extend(intents) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_delete_intents] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("IntentsClient",) diff --git a/google/cloud/dialogflow_v2/services/intents/pagers.py b/google/cloud/dialogflow_v2/services/intents/pagers.py new file mode 100644 index 000000000..ddbfb28f7 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/intents/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2.types import intent + + +class ListIntentsPager: + """A pager for iterating through ``list_intents`` requests. + + This class thinly wraps an initial + :class:`~.intent.ListIntentsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``intents`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListIntents`` requests and continue to iterate + through the ``intents`` field on the + corresponding responses. + + All the usual :class:`~.intent.ListIntentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., intent.ListIntentsResponse], + request: intent.ListIntentsRequest, + response: intent.ListIntentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.intent.ListIntentsRequest`): + The initial request object. + response (:class:`~.intent.ListIntentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = intent.ListIntentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[intent.ListIntentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[intent.Intent]: + for page in self.pages: + yield from page.intents + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListIntentsAsyncPager: + """A pager for iterating through ``list_intents`` requests. + + This class thinly wraps an initial + :class:`~.intent.ListIntentsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``intents`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListIntents`` requests and continue to iterate + through the ``intents`` field on the + corresponding responses. + + All the usual :class:`~.intent.ListIntentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[intent.ListIntentsResponse]], + request: intent.ListIntentsRequest, + response: intent.ListIntentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.intent.ListIntentsRequest`): + The initial request object. + response (:class:`~.intent.ListIntentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = intent.ListIntentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[intent.ListIntentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[intent.Intent]: + async def async_generator(): + async for page in self.pages: + for response in page.intents: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2/services/intents/transports/__init__.py b/google/cloud/dialogflow_v2/services/intents/transports/__init__.py new file mode 100644 index 000000000..ecbfad6b0 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/intents/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import IntentsTransport +from .grpc import IntentsGrpcTransport +from .grpc_asyncio import IntentsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[IntentsTransport]] +_transport_registry["grpc"] = IntentsGrpcTransport +_transport_registry["grpc_asyncio"] = IntentsGrpcAsyncIOTransport + + +__all__ = ( + "IntentsTransport", + "IntentsGrpcTransport", + "IntentsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2/services/intents/transports/base.py b/google/cloud/dialogflow_v2/services/intents/transports/base.py new file mode 100644 index 000000000..963054bce --- /dev/null +++ b/google/cloud/dialogflow_v2/services/intents/transports/base.py @@ -0,0 +1,214 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2.types import intent +from google.cloud.dialogflow_v2.types import intent as gcd_intent +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class IntentsTransport(abc.ABC): + """Abstract transport class for Intents.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + 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.get_intent: gapic_v1.method.wrap_method( + 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.update_intent: gapic_v1.method.wrap_method( + 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.batch_update_intents: gapic_v1.method.wrap_method( + self.batch_update_intents, + default_timeout=None, + client_info=client_info, + ), + self.batch_delete_intents: gapic_v1.method.wrap_method( + self.batch_delete_intents, + default_timeout=None, + client_info=client_info, + ), + } + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def list_intents( + self, + ) -> typing.Callable[ + [intent.ListIntentsRequest], + typing.Union[ + intent.ListIntentsResponse, typing.Awaitable[intent.ListIntentsResponse] + ], + ]: + raise NotImplementedError() + + @property + def get_intent( + self, + ) -> typing.Callable[ + [intent.GetIntentRequest], + typing.Union[intent.Intent, typing.Awaitable[intent.Intent]], + ]: + raise NotImplementedError() + + @property + def create_intent( + self, + ) -> typing.Callable[ + [gcd_intent.CreateIntentRequest], + typing.Union[gcd_intent.Intent, typing.Awaitable[gcd_intent.Intent]], + ]: + raise NotImplementedError() + + @property + def update_intent( + self, + ) -> typing.Callable[ + [gcd_intent.UpdateIntentRequest], + typing.Union[gcd_intent.Intent, typing.Awaitable[gcd_intent.Intent]], + ]: + raise NotImplementedError() + + @property + def delete_intent( + self, + ) -> typing.Callable[ + [intent.DeleteIntentRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def batch_update_intents( + self, + ) -> typing.Callable[ + [intent.BatchUpdateIntentsRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def batch_delete_intents( + self, + ) -> typing.Callable[ + [intent.BatchDeleteIntentsRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + +__all__ = ("IntentsTransport",) diff --git a/google/cloud/dialogflow_v2/services/intents/transports/grpc.py b/google/cloud/dialogflow_v2/services/intents/transports/grpc.py new file mode 100644 index 000000000..b7c5fbe65 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/intents/transports/grpc.py @@ -0,0 +1,439 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2.types import intent +from google.cloud.dialogflow_v2.types import intent as gcd_intent +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import IntentsTransport, DEFAULT_CLIENT_INFO + + +class IntentsGrpcTransport(IntentsTransport): + """gRPC backend transport for Intents. + + Service for managing [Intents][google.cloud.dialogflow.v2.Intent]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def list_intents( + self, + ) -> Callable[[intent.ListIntentsRequest], intent.ListIntentsResponse]: + r"""Return a callable for the list intents method over gRPC. + + Returns the list of all intents in the specified + agent. + + Returns: + Callable[[~.ListIntentsRequest], + ~.ListIntentsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_intents" not in self._stubs: + self._stubs["list_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/ListIntents", + request_serializer=intent.ListIntentsRequest.serialize, + response_deserializer=intent.ListIntentsResponse.deserialize, + ) + return self._stubs["list_intents"] + + @property + def get_intent(self) -> Callable[[intent.GetIntentRequest], intent.Intent]: + r"""Return a callable for the get intent method over gRPC. + + Retrieves the specified intent. + + Returns: + Callable[[~.GetIntentRequest], + ~.Intent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_intent" not in self._stubs: + self._stubs["get_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/GetIntent", + request_serializer=intent.GetIntentRequest.serialize, + response_deserializer=intent.Intent.deserialize, + ) + return self._stubs["get_intent"] + + @property + def create_intent( + self, + ) -> Callable[[gcd_intent.CreateIntentRequest], gcd_intent.Intent]: + r"""Return a callable for the create intent method over gRPC. + + Creates an intent in the specified agent. + + Returns: + Callable[[~.CreateIntentRequest], + ~.Intent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_intent" not in self._stubs: + self._stubs["create_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/CreateIntent", + request_serializer=gcd_intent.CreateIntentRequest.serialize, + response_deserializer=gcd_intent.Intent.deserialize, + ) + return self._stubs["create_intent"] + + @property + def update_intent( + self, + ) -> Callable[[gcd_intent.UpdateIntentRequest], gcd_intent.Intent]: + r"""Return a callable for the update intent method over gRPC. + + Updates the specified intent. + + Returns: + Callable[[~.UpdateIntentRequest], + ~.Intent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_intent" not in self._stubs: + self._stubs["update_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/UpdateIntent", + request_serializer=gcd_intent.UpdateIntentRequest.serialize, + response_deserializer=gcd_intent.Intent.deserialize, + ) + return self._stubs["update_intent"] + + @property + def delete_intent(self) -> Callable[[intent.DeleteIntentRequest], empty.Empty]: + r"""Return a callable for the delete intent method over gRPC. + + Deletes the specified intent and its direct or + indirect followup intents. + + Returns: + Callable[[~.DeleteIntentRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_intent" not in self._stubs: + self._stubs["delete_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/DeleteIntent", + request_serializer=intent.DeleteIntentRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_intent"] + + @property + def batch_update_intents( + self, + ) -> Callable[[intent.BatchUpdateIntentsRequest], operations.Operation]: + r"""Return a callable for the batch update intents method over gRPC. + + Updates/Creates multiple intents in the specified agent. + + Operation + + Returns: + Callable[[~.BatchUpdateIntentsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_intents" not in self._stubs: + self._stubs["batch_update_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/BatchUpdateIntents", + request_serializer=intent.BatchUpdateIntentsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_intents"] + + @property + def batch_delete_intents( + self, + ) -> Callable[[intent.BatchDeleteIntentsRequest], operations.Operation]: + r"""Return a callable for the batch delete intents method over gRPC. + + Deletes intents in the specified agent. + + Operation + + Returns: + Callable[[~.BatchDeleteIntentsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_intents" not in self._stubs: + self._stubs["batch_delete_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/BatchDeleteIntents", + request_serializer=intent.BatchDeleteIntentsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_intents"] + + +__all__ = ("IntentsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2/services/intents/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2/services/intents/transports/grpc_asyncio.py new file mode 100644 index 000000000..f9e8d1ff5 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/intents/transports/grpc_asyncio.py @@ -0,0 +1,447 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import operations_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2.types import intent +from google.cloud.dialogflow_v2.types import intent as gcd_intent +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import IntentsTransport, DEFAULT_CLIENT_INFO +from .grpc import IntentsGrpcTransport + + +class IntentsGrpcAsyncIOTransport(IntentsTransport): + """gRPC AsyncIO backend transport for Intents. + + Service for managing [Intents][google.cloud.dialogflow.v2.Intent]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def list_intents( + self, + ) -> Callable[[intent.ListIntentsRequest], Awaitable[intent.ListIntentsResponse]]: + r"""Return a callable for the list intents method over gRPC. + + Returns the list of all intents in the specified + agent. + + Returns: + Callable[[~.ListIntentsRequest], + Awaitable[~.ListIntentsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_intents" not in self._stubs: + self._stubs["list_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/ListIntents", + request_serializer=intent.ListIntentsRequest.serialize, + response_deserializer=intent.ListIntentsResponse.deserialize, + ) + return self._stubs["list_intents"] + + @property + def get_intent( + self, + ) -> Callable[[intent.GetIntentRequest], Awaitable[intent.Intent]]: + r"""Return a callable for the get intent method over gRPC. + + Retrieves the specified intent. + + Returns: + Callable[[~.GetIntentRequest], + Awaitable[~.Intent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_intent" not in self._stubs: + self._stubs["get_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/GetIntent", + request_serializer=intent.GetIntentRequest.serialize, + response_deserializer=intent.Intent.deserialize, + ) + return self._stubs["get_intent"] + + @property + def create_intent( + self, + ) -> Callable[[gcd_intent.CreateIntentRequest], Awaitable[gcd_intent.Intent]]: + r"""Return a callable for the create intent method over gRPC. + + Creates an intent in the specified agent. + + Returns: + Callable[[~.CreateIntentRequest], + Awaitable[~.Intent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_intent" not in self._stubs: + self._stubs["create_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/CreateIntent", + request_serializer=gcd_intent.CreateIntentRequest.serialize, + response_deserializer=gcd_intent.Intent.deserialize, + ) + return self._stubs["create_intent"] + + @property + def update_intent( + self, + ) -> Callable[[gcd_intent.UpdateIntentRequest], Awaitable[gcd_intent.Intent]]: + r"""Return a callable for the update intent method over gRPC. + + Updates the specified intent. + + Returns: + Callable[[~.UpdateIntentRequest], + Awaitable[~.Intent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_intent" not in self._stubs: + self._stubs["update_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/UpdateIntent", + request_serializer=gcd_intent.UpdateIntentRequest.serialize, + response_deserializer=gcd_intent.Intent.deserialize, + ) + return self._stubs["update_intent"] + + @property + def delete_intent( + self, + ) -> Callable[[intent.DeleteIntentRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete intent method over gRPC. + + Deletes the specified intent and its direct or + indirect followup intents. + + Returns: + Callable[[~.DeleteIntentRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_intent" not in self._stubs: + self._stubs["delete_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/DeleteIntent", + request_serializer=intent.DeleteIntentRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_intent"] + + @property + def batch_update_intents( + self, + ) -> Callable[[intent.BatchUpdateIntentsRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the batch update intents method over gRPC. + + Updates/Creates multiple intents in the specified agent. + + Operation + + Returns: + Callable[[~.BatchUpdateIntentsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_intents" not in self._stubs: + self._stubs["batch_update_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/BatchUpdateIntents", + request_serializer=intent.BatchUpdateIntentsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_intents"] + + @property + def batch_delete_intents( + self, + ) -> Callable[[intent.BatchDeleteIntentsRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the batch delete intents method over gRPC. + + Deletes intents in the specified agent. + + Operation + + Returns: + Callable[[~.BatchDeleteIntentsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_intents" not in self._stubs: + self._stubs["batch_delete_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Intents/BatchDeleteIntents", + request_serializer=intent.BatchDeleteIntentsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_intents"] + + +__all__ = ("IntentsGrpcAsyncIOTransport",) diff --git a/dialogflow/__init__.py b/google/cloud/dialogflow_v2/services/session_entity_types/__init__.py similarity index 53% rename from dialogflow/__init__.py rename to google/cloud/dialogflow_v2/services/session_entity_types/__init__.py index d5cf53b7a..c0dca267f 100644 --- a/dialogflow/__init__.py +++ b/google/cloud/dialogflow_v2/services/session_entity_types/__init__.py @@ -1,4 +1,6 @@ -# Copyright 2017, Google LLC +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,25 +13,12 @@ # 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. +# -from __future__ import absolute_import - -from dialogflow_v2 import AgentsClient -from dialogflow_v2 import ContextsClient -from dialogflow_v2 import EntityTypesClient -from dialogflow_v2 import IntentsClient -from dialogflow_v2 import SessionEntityTypesClient -from dialogflow_v2 import SessionsClient -from dialogflow_v2 import enums -from dialogflow_v2 import types +from .client import SessionEntityTypesClient +from .async_client import SessionEntityTypesAsyncClient __all__ = ( - "enums", - "types", - "AgentsClient", - "ContextsClient", - "EntityTypesClient", - "IntentsClient", "SessionEntityTypesClient", - "SessionsClient", + "SessionEntityTypesAsyncClient", ) diff --git a/google/cloud/dialogflow_v2/services/session_entity_types/async_client.py b/google/cloud/dialogflow_v2/services/session_entity_types/async_client.py new file mode 100644 index 000000000..c0fa9de2b --- /dev/null +++ b/google/cloud/dialogflow_v2/services/session_entity_types/async_client.py @@ -0,0 +1,611 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2.services.session_entity_types import pagers +from google.cloud.dialogflow_v2.types import entity_type +from google.cloud.dialogflow_v2.types import session_entity_type +from google.cloud.dialogflow_v2.types import ( + session_entity_type as gcd_session_entity_type, +) +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + +from .transports.base import SessionEntityTypesTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import SessionEntityTypesGrpcAsyncIOTransport +from .client import SessionEntityTypesClient + + +class SessionEntityTypesAsyncClient: + """Service for managing + [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType]. + """ + + _client: SessionEntityTypesClient + + DEFAULT_ENDPOINT = SessionEntityTypesClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = SessionEntityTypesClient.DEFAULT_MTLS_ENDPOINT + + session_entity_type_path = staticmethod( + SessionEntityTypesClient.session_entity_type_path + ) + parse_session_entity_type_path = staticmethod( + SessionEntityTypesClient.parse_session_entity_type_path + ) + + common_billing_account_path = staticmethod( + SessionEntityTypesClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + SessionEntityTypesClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(SessionEntityTypesClient.common_folder_path) + parse_common_folder_path = staticmethod( + SessionEntityTypesClient.parse_common_folder_path + ) + + common_organization_path = staticmethod( + SessionEntityTypesClient.common_organization_path + ) + parse_common_organization_path = staticmethod( + SessionEntityTypesClient.parse_common_organization_path + ) + + common_project_path = staticmethod(SessionEntityTypesClient.common_project_path) + parse_common_project_path = staticmethod( + SessionEntityTypesClient.parse_common_project_path + ) + + common_location_path = staticmethod(SessionEntityTypesClient.common_location_path) + parse_common_location_path = staticmethod( + SessionEntityTypesClient.parse_common_location_path + ) + + from_service_account_file = SessionEntityTypesClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> SessionEntityTypesTransport: + """Return the transport used by the client instance. + + Returns: + SessionEntityTypesTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(SessionEntityTypesClient).get_transport_class, + type(SessionEntityTypesClient), + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, SessionEntityTypesTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the session entity types client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.SessionEntityTypesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = SessionEntityTypesClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_session_entity_types( + self, + request: session_entity_type.ListSessionEntityTypesRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListSessionEntityTypesAsyncPager: + r"""Returns the list of all session entity types in the + specified session. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.ListSessionEntityTypesRequest`): + The request object. The request message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. + parent (:class:`str`): + Required. The session to list all session entity types + from. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users// sessions/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListSessionEntityTypesAsyncPager: + The response message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = session_entity_type.ListSessionEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_session_entity_types, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def get_session_entity_type( + self, + request: session_entity_type.GetSessionEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> session_entity_type.SessionEntityType: + r"""Retrieves the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.GetSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType]. + name (:class:`str`): + Required. The name of the session entity type. Format: + ``projects//agent/sessions//entityTypes/`` + or + ``projects//agent/environments//users//sessions//entityTypes/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = session_entity_type.GetSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_session_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_session_entity_type( + self, + request: gcd_session_entity_type.CreateSessionEntityTypeRequest = None, + *, + parent: str = None, + session_entity_type: gcd_session_entity_type.SessionEntityType = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session_entity_type.SessionEntityType: + r"""Creates a session entity type. + If the specified session entity type already exists, + overrides the session entity type. + + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.gcd_session_entity_type.CreateSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType]. + parent (:class:`str`): + Required. The session to create a session entity type + for. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users// sessions/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + session_entity_type (:class:`~.gcd_session_entity_type.SessionEntityType`): + Required. The session entity type to + create. + This corresponds to the ``session_entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, session_entity_type]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_session_entity_type.CreateSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if session_entity_type is not None: + request.session_entity_type = session_entity_type + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_session_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def update_session_entity_type( + self, + request: gcd_session_entity_type.UpdateSessionEntityTypeRequest = None, + *, + session_entity_type: gcd_session_entity_type.SessionEntityType = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session_entity_type.SessionEntityType: + r"""Updates the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.gcd_session_entity_type.UpdateSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType]. + session_entity_type (:class:`~.gcd_session_entity_type.SessionEntityType`): + Required. The session entity type to + update. + This corresponds to the ``session_entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([session_entity_type, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_session_entity_type.UpdateSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if session_entity_type is not None: + request.session_entity_type = session_entity_type + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_session_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("session_entity_type.name", request.session_entity_type.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_session_entity_type( + self, + request: session_entity_type.DeleteSessionEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.DeleteSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType]. + name (:class:`str`): + Required. The name of the entity type to delete. Format: + ``projects//agent/sessions//entityTypes/`` + or + ``projects//agent/environments//users//sessions//entityTypes/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = session_entity_type.DeleteSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_session_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("SessionEntityTypesAsyncClient",) diff --git a/google/cloud/dialogflow_v2/services/session_entity_types/client.py b/google/cloud/dialogflow_v2/services/session_entity_types/client.py new file mode 100644 index 000000000..e85237b7b --- /dev/null +++ b/google/cloud/dialogflow_v2/services/session_entity_types/client.py @@ -0,0 +1,816 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2.services.session_entity_types import pagers +from google.cloud.dialogflow_v2.types import entity_type +from google.cloud.dialogflow_v2.types import session_entity_type +from google.cloud.dialogflow_v2.types import ( + session_entity_type as gcd_session_entity_type, +) +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + +from .transports.base import SessionEntityTypesTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import SessionEntityTypesGrpcTransport +from .transports.grpc_asyncio import SessionEntityTypesGrpcAsyncIOTransport + + +class SessionEntityTypesClientMeta(type): + """Metaclass for the SessionEntityTypes client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[SessionEntityTypesTransport]] + _transport_registry["grpc"] = SessionEntityTypesGrpcTransport + _transport_registry["grpc_asyncio"] = SessionEntityTypesGrpcAsyncIOTransport + + def get_transport_class( + cls, label: str = None, + ) -> Type[SessionEntityTypesTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class SessionEntityTypesClient(metaclass=SessionEntityTypesClientMeta): + """Service for managing + [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> SessionEntityTypesTransport: + """Return the transport used by the client instance. + + Returns: + SessionEntityTypesTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def session_entity_type_path(project: str, session: str, entity_type: str,) -> str: + """Return a fully-qualified session_entity_type string.""" + return "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}".format( + project=project, session=session, entity_type=entity_type, + ) + + @staticmethod + def parse_session_entity_type_path(path: str) -> Dict[str, str]: + """Parse a session_entity_type path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/entityTypes/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, SessionEntityTypesTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the session entity types client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.SessionEntityTypesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, SessionEntityTypesTransport): + # transport is a SessionEntityTypesTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_session_entity_types( + self, + request: session_entity_type.ListSessionEntityTypesRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListSessionEntityTypesPager: + r"""Returns the list of all session entity types in the + specified session. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.ListSessionEntityTypesRequest`): + The request object. The request message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. + parent (:class:`str`): + Required. The session to list all session entity types + from. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users// sessions/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListSessionEntityTypesPager: + The response message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a session_entity_type.ListSessionEntityTypesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, session_entity_type.ListSessionEntityTypesRequest): + request = session_entity_type.ListSessionEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.list_session_entity_types + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def get_session_entity_type( + self, + request: session_entity_type.GetSessionEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> session_entity_type.SessionEntityType: + r"""Retrieves the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.GetSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType]. + name (:class:`str`): + Required. The name of the session entity type. Format: + ``projects//agent/sessions//entityTypes/`` + or + ``projects//agent/environments//users//sessions//entityTypes/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a session_entity_type.GetSessionEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, session_entity_type.GetSessionEntityTypeRequest): + request = session_entity_type.GetSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_session_entity_type] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_session_entity_type( + self, + request: gcd_session_entity_type.CreateSessionEntityTypeRequest = None, + *, + parent: str = None, + session_entity_type: gcd_session_entity_type.SessionEntityType = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session_entity_type.SessionEntityType: + r"""Creates a session entity type. + If the specified session entity type already exists, + overrides the session entity type. + + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.gcd_session_entity_type.CreateSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType]. + parent (:class:`str`): + Required. The session to create a session entity type + for. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users// sessions/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + session_entity_type (:class:`~.gcd_session_entity_type.SessionEntityType`): + Required. The session entity type to + create. + This corresponds to the ``session_entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, session_entity_type]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_session_entity_type.CreateSessionEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, gcd_session_entity_type.CreateSessionEntityTypeRequest + ): + request = gcd_session_entity_type.CreateSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if session_entity_type is not None: + request.session_entity_type = session_entity_type + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.create_session_entity_type + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def update_session_entity_type( + self, + request: gcd_session_entity_type.UpdateSessionEntityTypeRequest = None, + *, + session_entity_type: gcd_session_entity_type.SessionEntityType = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session_entity_type.SessionEntityType: + r"""Updates the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.gcd_session_entity_type.UpdateSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType]. + session_entity_type (:class:`~.gcd_session_entity_type.SessionEntityType`): + Required. The session entity type to + update. + This corresponds to the ``session_entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([session_entity_type, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_session_entity_type.UpdateSessionEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, gcd_session_entity_type.UpdateSessionEntityTypeRequest + ): + request = gcd_session_entity_type.UpdateSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if session_entity_type is not None: + request.session_entity_type = session_entity_type + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.update_session_entity_type + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("session_entity_type.name", request.session_entity_type.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_session_entity_type( + self, + request: session_entity_type.DeleteSessionEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.DeleteSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType]. + name (:class:`str`): + Required. The name of the entity type to delete. Format: + ``projects//agent/sessions//entityTypes/`` + or + ``projects//agent/environments//users//sessions//entityTypes/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a session_entity_type.DeleteSessionEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, session_entity_type.DeleteSessionEntityTypeRequest): + request = session_entity_type.DeleteSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.delete_session_entity_type + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("SessionEntityTypesClient",) diff --git a/google/cloud/dialogflow_v2/services/session_entity_types/pagers.py b/google/cloud/dialogflow_v2/services/session_entity_types/pagers.py new file mode 100644 index 000000000..0a9a3c177 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/session_entity_types/pagers.py @@ -0,0 +1,152 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2.types import session_entity_type + + +class ListSessionEntityTypesPager: + """A pager for iterating through ``list_session_entity_types`` requests. + + This class thinly wraps an initial + :class:`~.session_entity_type.ListSessionEntityTypesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``session_entity_types`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListSessionEntityTypes`` requests and continue to iterate + through the ``session_entity_types`` field on the + corresponding responses. + + All the usual :class:`~.session_entity_type.ListSessionEntityTypesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., session_entity_type.ListSessionEntityTypesResponse], + request: session_entity_type.ListSessionEntityTypesRequest, + response: session_entity_type.ListSessionEntityTypesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.session_entity_type.ListSessionEntityTypesRequest`): + The initial request object. + response (:class:`~.session_entity_type.ListSessionEntityTypesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = session_entity_type.ListSessionEntityTypesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[session_entity_type.ListSessionEntityTypesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[session_entity_type.SessionEntityType]: + for page in self.pages: + yield from page.session_entity_types + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListSessionEntityTypesAsyncPager: + """A pager for iterating through ``list_session_entity_types`` requests. + + This class thinly wraps an initial + :class:`~.session_entity_type.ListSessionEntityTypesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``session_entity_types`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListSessionEntityTypes`` requests and continue to iterate + through the ``session_entity_types`` field on the + corresponding responses. + + All the usual :class:`~.session_entity_type.ListSessionEntityTypesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[ + ..., Awaitable[session_entity_type.ListSessionEntityTypesResponse] + ], + request: session_entity_type.ListSessionEntityTypesRequest, + response: session_entity_type.ListSessionEntityTypesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.session_entity_type.ListSessionEntityTypesRequest`): + The initial request object. + response (:class:`~.session_entity_type.ListSessionEntityTypesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = session_entity_type.ListSessionEntityTypesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages( + self, + ) -> AsyncIterable[session_entity_type.ListSessionEntityTypesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[session_entity_type.SessionEntityType]: + async def async_generator(): + async for page in self.pages: + for response in page.session_entity_types: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2/services/session_entity_types/transports/__init__.py b/google/cloud/dialogflow_v2/services/session_entity_types/transports/__init__.py new file mode 100644 index 000000000..7ab5a895a --- /dev/null +++ b/google/cloud/dialogflow_v2/services/session_entity_types/transports/__init__.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import SessionEntityTypesTransport +from .grpc import SessionEntityTypesGrpcTransport +from .grpc_asyncio import SessionEntityTypesGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = ( + OrderedDict() +) # type: Dict[str, Type[SessionEntityTypesTransport]] +_transport_registry["grpc"] = SessionEntityTypesGrpcTransport +_transport_registry["grpc_asyncio"] = SessionEntityTypesGrpcAsyncIOTransport + + +__all__ = ( + "SessionEntityTypesTransport", + "SessionEntityTypesGrpcTransport", + "SessionEntityTypesGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2/services/session_entity_types/transports/base.py b/google/cloud/dialogflow_v2/services/session_entity_types/transports/base.py new file mode 100644 index 000000000..67a27daff --- /dev/null +++ b/google/cloud/dialogflow_v2/services/session_entity_types/transports/base.py @@ -0,0 +1,201 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2.types import session_entity_type +from google.cloud.dialogflow_v2.types import ( + session_entity_type as gcd_session_entity_type, +) +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class SessionEntityTypesTransport(abc.ABC): + """Abstract transport class for SessionEntityTypes.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_session_entity_types: gapic_v1.method.wrap_method( + self.list_session_entity_types, + default_timeout=None, + client_info=client_info, + ), + self.get_session_entity_type: gapic_v1.method.wrap_method( + self.get_session_entity_type, + default_timeout=None, + client_info=client_info, + ), + self.create_session_entity_type: gapic_v1.method.wrap_method( + self.create_session_entity_type, + default_timeout=None, + client_info=client_info, + ), + self.update_session_entity_type: gapic_v1.method.wrap_method( + self.update_session_entity_type, + default_timeout=None, + client_info=client_info, + ), + self.delete_session_entity_type: gapic_v1.method.wrap_method( + self.delete_session_entity_type, + default_timeout=None, + client_info=client_info, + ), + } + + @property + def list_session_entity_types( + self, + ) -> typing.Callable[ + [session_entity_type.ListSessionEntityTypesRequest], + typing.Union[ + session_entity_type.ListSessionEntityTypesResponse, + typing.Awaitable[session_entity_type.ListSessionEntityTypesResponse], + ], + ]: + raise NotImplementedError() + + @property + def get_session_entity_type( + self, + ) -> typing.Callable[ + [session_entity_type.GetSessionEntityTypeRequest], + typing.Union[ + session_entity_type.SessionEntityType, + typing.Awaitable[session_entity_type.SessionEntityType], + ], + ]: + raise NotImplementedError() + + @property + def create_session_entity_type( + self, + ) -> typing.Callable[ + [gcd_session_entity_type.CreateSessionEntityTypeRequest], + typing.Union[ + gcd_session_entity_type.SessionEntityType, + typing.Awaitable[gcd_session_entity_type.SessionEntityType], + ], + ]: + raise NotImplementedError() + + @property + def update_session_entity_type( + self, + ) -> typing.Callable[ + [gcd_session_entity_type.UpdateSessionEntityTypeRequest], + typing.Union[ + gcd_session_entity_type.SessionEntityType, + typing.Awaitable[gcd_session_entity_type.SessionEntityType], + ], + ]: + raise NotImplementedError() + + @property + def delete_session_entity_type( + self, + ) -> typing.Callable[ + [session_entity_type.DeleteSessionEntityTypeRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + +__all__ = ("SessionEntityTypesTransport",) diff --git a/google/cloud/dialogflow_v2/services/session_entity_types/transports/grpc.py b/google/cloud/dialogflow_v2/services/session_entity_types/transports/grpc.py new file mode 100644 index 000000000..852b717b4 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/session_entity_types/transports/grpc.py @@ -0,0 +1,399 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2.types import session_entity_type +from google.cloud.dialogflow_v2.types import ( + session_entity_type as gcd_session_entity_type, +) +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import SessionEntityTypesTransport, DEFAULT_CLIENT_INFO + + +class SessionEntityTypesGrpcTransport(SessionEntityTypesTransport): + """gRPC backend transport for SessionEntityTypes. + + Service for managing + [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def list_session_entity_types( + self, + ) -> Callable[ + [session_entity_type.ListSessionEntityTypesRequest], + session_entity_type.ListSessionEntityTypesResponse, + ]: + r"""Return a callable for the list session entity types method over gRPC. + + Returns the list of all session entity types in the + specified session. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.ListSessionEntityTypesRequest], + ~.ListSessionEntityTypesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_session_entity_types" not in self._stubs: + self._stubs["list_session_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.SessionEntityTypes/ListSessionEntityTypes", + request_serializer=session_entity_type.ListSessionEntityTypesRequest.serialize, + response_deserializer=session_entity_type.ListSessionEntityTypesResponse.deserialize, + ) + return self._stubs["list_session_entity_types"] + + @property + def get_session_entity_type( + self, + ) -> Callable[ + [session_entity_type.GetSessionEntityTypeRequest], + session_entity_type.SessionEntityType, + ]: + r"""Return a callable for the get session entity type method over gRPC. + + Retrieves the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.GetSessionEntityTypeRequest], + ~.SessionEntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_session_entity_type" not in self._stubs: + self._stubs["get_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.SessionEntityTypes/GetSessionEntityType", + request_serializer=session_entity_type.GetSessionEntityTypeRequest.serialize, + response_deserializer=session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["get_session_entity_type"] + + @property + def create_session_entity_type( + self, + ) -> Callable[ + [gcd_session_entity_type.CreateSessionEntityTypeRequest], + gcd_session_entity_type.SessionEntityType, + ]: + r"""Return a callable for the create session entity type method over gRPC. + + Creates a session entity type. + If the specified session entity type already exists, + overrides the session entity type. + + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.CreateSessionEntityTypeRequest], + ~.SessionEntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_session_entity_type" not in self._stubs: + self._stubs["create_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.SessionEntityTypes/CreateSessionEntityType", + request_serializer=gcd_session_entity_type.CreateSessionEntityTypeRequest.serialize, + response_deserializer=gcd_session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["create_session_entity_type"] + + @property + def update_session_entity_type( + self, + ) -> Callable[ + [gcd_session_entity_type.UpdateSessionEntityTypeRequest], + gcd_session_entity_type.SessionEntityType, + ]: + r"""Return a callable for the update session entity type method over gRPC. + + Updates the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.UpdateSessionEntityTypeRequest], + ~.SessionEntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_session_entity_type" not in self._stubs: + self._stubs["update_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.SessionEntityTypes/UpdateSessionEntityType", + request_serializer=gcd_session_entity_type.UpdateSessionEntityTypeRequest.serialize, + response_deserializer=gcd_session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["update_session_entity_type"] + + @property + def delete_session_entity_type( + self, + ) -> Callable[[session_entity_type.DeleteSessionEntityTypeRequest], empty.Empty]: + r"""Return a callable for the delete session entity type method over gRPC. + + Deletes the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.DeleteSessionEntityTypeRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_session_entity_type" not in self._stubs: + self._stubs["delete_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.SessionEntityTypes/DeleteSessionEntityType", + request_serializer=session_entity_type.DeleteSessionEntityTypeRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_session_entity_type"] + + +__all__ = ("SessionEntityTypesGrpcTransport",) diff --git a/google/cloud/dialogflow_v2/services/session_entity_types/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2/services/session_entity_types/transports/grpc_asyncio.py new file mode 100644 index 000000000..69fb522b1 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/session_entity_types/transports/grpc_asyncio.py @@ -0,0 +1,405 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2.types import session_entity_type +from google.cloud.dialogflow_v2.types import ( + session_entity_type as gcd_session_entity_type, +) +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import SessionEntityTypesTransport, DEFAULT_CLIENT_INFO +from .grpc import SessionEntityTypesGrpcTransport + + +class SessionEntityTypesGrpcAsyncIOTransport(SessionEntityTypesTransport): + """gRPC AsyncIO backend transport for SessionEntityTypes. + + Service for managing + [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def list_session_entity_types( + self, + ) -> Callable[ + [session_entity_type.ListSessionEntityTypesRequest], + Awaitable[session_entity_type.ListSessionEntityTypesResponse], + ]: + r"""Return a callable for the list session entity types method over gRPC. + + Returns the list of all session entity types in the + specified session. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.ListSessionEntityTypesRequest], + Awaitable[~.ListSessionEntityTypesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_session_entity_types" not in self._stubs: + self._stubs["list_session_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.SessionEntityTypes/ListSessionEntityTypes", + request_serializer=session_entity_type.ListSessionEntityTypesRequest.serialize, + response_deserializer=session_entity_type.ListSessionEntityTypesResponse.deserialize, + ) + return self._stubs["list_session_entity_types"] + + @property + def get_session_entity_type( + self, + ) -> Callable[ + [session_entity_type.GetSessionEntityTypeRequest], + Awaitable[session_entity_type.SessionEntityType], + ]: + r"""Return a callable for the get session entity type method over gRPC. + + Retrieves the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.GetSessionEntityTypeRequest], + Awaitable[~.SessionEntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_session_entity_type" not in self._stubs: + self._stubs["get_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.SessionEntityTypes/GetSessionEntityType", + request_serializer=session_entity_type.GetSessionEntityTypeRequest.serialize, + response_deserializer=session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["get_session_entity_type"] + + @property + def create_session_entity_type( + self, + ) -> Callable[ + [gcd_session_entity_type.CreateSessionEntityTypeRequest], + Awaitable[gcd_session_entity_type.SessionEntityType], + ]: + r"""Return a callable for the create session entity type method over gRPC. + + Creates a session entity type. + If the specified session entity type already exists, + overrides the session entity type. + + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.CreateSessionEntityTypeRequest], + Awaitable[~.SessionEntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_session_entity_type" not in self._stubs: + self._stubs["create_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.SessionEntityTypes/CreateSessionEntityType", + request_serializer=gcd_session_entity_type.CreateSessionEntityTypeRequest.serialize, + response_deserializer=gcd_session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["create_session_entity_type"] + + @property + def update_session_entity_type( + self, + ) -> Callable[ + [gcd_session_entity_type.UpdateSessionEntityTypeRequest], + Awaitable[gcd_session_entity_type.SessionEntityType], + ]: + r"""Return a callable for the update session entity type method over gRPC. + + Updates the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.UpdateSessionEntityTypeRequest], + Awaitable[~.SessionEntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_session_entity_type" not in self._stubs: + self._stubs["update_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.SessionEntityTypes/UpdateSessionEntityType", + request_serializer=gcd_session_entity_type.UpdateSessionEntityTypeRequest.serialize, + response_deserializer=gcd_session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["update_session_entity_type"] + + @property + def delete_session_entity_type( + self, + ) -> Callable[ + [session_entity_type.DeleteSessionEntityTypeRequest], Awaitable[empty.Empty] + ]: + r"""Return a callable for the delete session entity type method over gRPC. + + Deletes the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.DeleteSessionEntityTypeRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_session_entity_type" not in self._stubs: + self._stubs["delete_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.SessionEntityTypes/DeleteSessionEntityType", + request_serializer=session_entity_type.DeleteSessionEntityTypeRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_session_entity_type"] + + +__all__ = ("SessionEntityTypesGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2/services/sessions/__init__.py b/google/cloud/dialogflow_v2/services/sessions/__init__.py new file mode 100644 index 000000000..3b2a59a9d --- /dev/null +++ b/google/cloud/dialogflow_v2/services/sessions/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import SessionsClient +from .async_client import SessionsAsyncClient + +__all__ = ( + "SessionsClient", + "SessionsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2/services/sessions/async_client.py b/google/cloud/dialogflow_v2/services/sessions/async_client.py new file mode 100644 index 000000000..4e5f36b55 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/sessions/async_client.py @@ -0,0 +1,384 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import ( + Dict, + AsyncIterable, + Awaitable, + AsyncIterator, + Sequence, + Tuple, + Type, + Union, +) +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2.types import audio_config +from google.cloud.dialogflow_v2.types import session +from google.cloud.dialogflow_v2.types import session as gcd_session +from google.rpc import status_pb2 as status # type: ignore + +from .transports.base import SessionsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import SessionsGrpcAsyncIOTransport +from .client import SessionsClient + + +class SessionsAsyncClient: + """A service used for session interactions. + + For more information, see the `API interactions + guide `__. + """ + + _client: SessionsClient + + DEFAULT_ENDPOINT = SessionsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = SessionsClient.DEFAULT_MTLS_ENDPOINT + + context_path = staticmethod(SessionsClient.context_path) + parse_context_path = staticmethod(SessionsClient.parse_context_path) + intent_path = staticmethod(SessionsClient.intent_path) + parse_intent_path = staticmethod(SessionsClient.parse_intent_path) + session_path = staticmethod(SessionsClient.session_path) + parse_session_path = staticmethod(SessionsClient.parse_session_path) + session_entity_type_path = staticmethod(SessionsClient.session_entity_type_path) + parse_session_entity_type_path = staticmethod( + SessionsClient.parse_session_entity_type_path + ) + + common_billing_account_path = staticmethod( + SessionsClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + SessionsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(SessionsClient.common_folder_path) + parse_common_folder_path = staticmethod(SessionsClient.parse_common_folder_path) + + common_organization_path = staticmethod(SessionsClient.common_organization_path) + parse_common_organization_path = staticmethod( + SessionsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(SessionsClient.common_project_path) + parse_common_project_path = staticmethod(SessionsClient.parse_common_project_path) + + common_location_path = staticmethod(SessionsClient.common_location_path) + parse_common_location_path = staticmethod(SessionsClient.parse_common_location_path) + + from_service_account_file = SessionsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> SessionsTransport: + """Return the transport used by the client instance. + + Returns: + SessionsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(SessionsClient).get_transport_class, type(SessionsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, SessionsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the sessions client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.SessionsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = SessionsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def detect_intent( + self, + request: gcd_session.DetectIntentRequest = None, + *, + session: str = None, + query_input: gcd_session.QueryInput = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session.DetectIntentResponse: + r"""Processes a natural language query and returns structured, + actionable data as a result. This method is not idempotent, + because it may cause contexts and session entity types to be + updated, which in turn might affect results of future queries. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Args: + request (:class:`~.gcd_session.DetectIntentRequest`): + The request object. The request to detect user's intent. + session (:class:`str`): + Required. The name of the session this query is sent to. + Format: + ``projects//agent/sessions/``, + or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we are using "-". It's up to the API caller + to choose an appropriate ``Session ID`` and ``User Id``. + They can be a random number or some type of user and + session identifiers (preferably hashed). The length of + the ``Session ID`` and ``User ID`` must not exceed 36 + characters. + + For more information, see the `API interactions + guide `__. + + Note: Always use agent versions for production traffic. + See `Versions and + environments `__. + This corresponds to the ``session`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + query_input (:class:`~.gcd_session.QueryInput`): + Required. The input specification. It + can be set to: + 1. an audio config + which instructs the speech + recognizer how to process the speech + audio, + 2. a conversational query in the form + of text, or + 3. an event that specifies which intent + to trigger. + This corresponds to the ``query_input`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session.DetectIntentResponse: + The message returned from the + DetectIntent method. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([session, query_input]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_session.DetectIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if session is not None: + request.session = session + if query_input is not None: + request.query_input = query_input + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.detect_intent, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), + ), + default_timeout=220.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("session", request.session),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def streaming_detect_intent( + self, + requests: AsyncIterator[session.StreamingDetectIntentRequest] = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> Awaitable[AsyncIterable[session.StreamingDetectIntentResponse]]: + r"""Processes a natural language query in audio format in a + streaming fashion and returns structured, actionable data as a + result. This method is only available via the gRPC API (not + REST). + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Args: + requests (AsyncIterator[`~.session.StreamingDetectIntentRequest`]): + The request object AsyncIterator. The top-level message sent by the + client to the + [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent] + method. + + Multiple request messages should be sent in order: + + 1. The first message must contain + [session][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session], + [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] + plus optionally + [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. + If the client wants to receive an audio response, it + should also contain + [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]. + The message must not contain + [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]. + 2. If + [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] + was set to + [query_input.audio_config][google.cloud.dialogflow.v2.InputAudioConfig], + all subsequent messages must contain + [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio] + to continue with Speech recognition. If you decide to + rather detect an intent from text input after you + already started Speech recognition, please send a + message with + [query_input.text][google.cloud.dialogflow.v2.QueryInput.text]. + However, note that: + + * Dialogflow will bill you for the audio duration so + far. * Dialogflow discards all Speech recognition + results in favor of the input text. + * Dialogflow will use the language code from the + first message. + After you sent all input, you must half-close or abort + the request stream. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + AsyncIterable[~.session.StreamingDetectIntentResponse]: + The top-level message returned from the + ``StreamingDetectIntent`` method. + + Multiple response messages can be returned in order: + + 1. If the input was set to streaming audio, the first + one or more messages contain ``recognition_result``. + Each ``recognition_result`` represents a more + complete transcript of what the user said. The last + ``recognition_result`` has ``is_final`` set to + ``true``. + + 2. The next message contains ``response_id``, + ``query_result`` and optionally ``webhook_status`` if + a WebHook was called. + + """ + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.streaming_detect_intent, + default_timeout=220.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Send the request. + response = rpc(requests, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("SessionsAsyncClient",) diff --git a/google/cloud/dialogflow_v2/services/sessions/client.py b/google/cloud/dialogflow_v2/services/sessions/client.py new file mode 100644 index 000000000..e19cd5989 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/sessions/client.py @@ -0,0 +1,609 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import ( + Callable, + Dict, + Optional, + Iterable, + Iterator, + Sequence, + Tuple, + Type, + Union, +) +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2.types import audio_config +from google.cloud.dialogflow_v2.types import session +from google.cloud.dialogflow_v2.types import session as gcd_session +from google.rpc import status_pb2 as status # type: ignore + +from .transports.base import SessionsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import SessionsGrpcTransport +from .transports.grpc_asyncio import SessionsGrpcAsyncIOTransport + + +class SessionsClientMeta(type): + """Metaclass for the Sessions client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[SessionsTransport]] + _transport_registry["grpc"] = SessionsGrpcTransport + _transport_registry["grpc_asyncio"] = SessionsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[SessionsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class SessionsClient(metaclass=SessionsClientMeta): + """A service used for session interactions. + + For more information, see the `API interactions + guide `__. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> SessionsTransport: + """Return the transport used by the client instance. + + Returns: + SessionsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def context_path(project: str, session: str, context: str,) -> str: + """Return a fully-qualified context string.""" + return "projects/{project}/agent/sessions/{session}/contexts/{context}".format( + project=project, session=session, context=context, + ) + + @staticmethod + def parse_context_path(path: str) -> Dict[str, str]: + """Parse a context path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/contexts/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def intent_path(project: str, intent: str,) -> str: + """Return a fully-qualified intent string.""" + return "projects/{project}/agent/intents/{intent}".format( + project=project, intent=intent, + ) + + @staticmethod + def parse_intent_path(path: str) -> Dict[str, str]: + """Parse a intent path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/agent/intents/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def session_path(project: str, session: str,) -> str: + """Return a fully-qualified session string.""" + return "projects/{project}/agent/sessions/{session}".format( + project=project, session=session, + ) + + @staticmethod + def parse_session_path(path: str) -> Dict[str, str]: + """Parse a session path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)$", path + ) + return m.groupdict() if m else {} + + @staticmethod + def session_entity_type_path(project: str, session: str, entity_type: str,) -> str: + """Return a fully-qualified session_entity_type string.""" + return "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}".format( + project=project, session=session, entity_type=entity_type, + ) + + @staticmethod + def parse_session_entity_type_path(path: str) -> Dict[str, str]: + """Parse a session_entity_type path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/entityTypes/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, SessionsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the sessions client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.SessionsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, SessionsTransport): + # transport is a SessionsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def detect_intent( + self, + request: gcd_session.DetectIntentRequest = None, + *, + session: str = None, + query_input: gcd_session.QueryInput = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session.DetectIntentResponse: + r"""Processes a natural language query and returns structured, + actionable data as a result. This method is not idempotent, + because it may cause contexts and session entity types to be + updated, which in turn might affect results of future queries. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Args: + request (:class:`~.gcd_session.DetectIntentRequest`): + The request object. The request to detect user's intent. + session (:class:`str`): + Required. The name of the session this query is sent to. + Format: + ``projects//agent/sessions/``, + or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we are using "-". It's up to the API caller + to choose an appropriate ``Session ID`` and ``User Id``. + They can be a random number or some type of user and + session identifiers (preferably hashed). The length of + the ``Session ID`` and ``User ID`` must not exceed 36 + characters. + + For more information, see the `API interactions + guide `__. + + Note: Always use agent versions for production traffic. + See `Versions and + environments `__. + This corresponds to the ``session`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + query_input (:class:`~.gcd_session.QueryInput`): + Required. The input specification. It + can be set to: + 1. an audio config + which instructs the speech + recognizer how to process the speech + audio, + 2. a conversational query in the form + of text, or + 3. an event that specifies which intent + to trigger. + This corresponds to the ``query_input`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session.DetectIntentResponse: + The message returned from the + DetectIntent method. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([session, query_input]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_session.DetectIntentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_session.DetectIntentRequest): + request = gcd_session.DetectIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if session is not None: + request.session = session + if query_input is not None: + request.query_input = query_input + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.detect_intent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("session", request.session),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def streaming_detect_intent( + self, + requests: Iterator[session.StreamingDetectIntentRequest] = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> Iterable[session.StreamingDetectIntentResponse]: + r"""Processes a natural language query in audio format in a + streaming fashion and returns structured, actionable data as a + result. This method is only available via the gRPC API (not + REST). + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Args: + requests (Iterator[`~.session.StreamingDetectIntentRequest`]): + The request object iterator. The top-level message sent by the + client to the + [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent] + method. + + Multiple request messages should be sent in order: + + 1. The first message must contain + [session][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session], + [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] + plus optionally + [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. + If the client wants to receive an audio response, it + should also contain + [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]. + The message must not contain + [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]. + 2. If + [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] + was set to + [query_input.audio_config][google.cloud.dialogflow.v2.InputAudioConfig], + all subsequent messages must contain + [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio] + to continue with Speech recognition. If you decide to + rather detect an intent from text input after you + already started Speech recognition, please send a + message with + [query_input.text][google.cloud.dialogflow.v2.QueryInput.text]. + However, note that: + + * Dialogflow will bill you for the audio duration so + far. * Dialogflow discards all Speech recognition + results in favor of the input text. + * Dialogflow will use the language code from the + first message. + After you sent all input, you must half-close or abort + the request stream. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + Iterable[~.session.StreamingDetectIntentResponse]: + The top-level message returned from the + ``StreamingDetectIntent`` method. + + Multiple response messages can be returned in order: + + 1. If the input was set to streaming audio, the first + one or more messages contain ``recognition_result``. + Each ``recognition_result`` represents a more + complete transcript of what the user said. The last + ``recognition_result`` has ``is_final`` set to + ``true``. + + 2. The next message contains ``response_id``, + ``query_result`` and optionally ``webhook_status`` if + a WebHook was called. + + """ + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.streaming_detect_intent] + + # Send the request. + response = rpc(requests, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("SessionsClient",) diff --git a/google/cloud/dialogflow_v2/services/sessions/transports/__init__.py b/google/cloud/dialogflow_v2/services/sessions/transports/__init__.py new file mode 100644 index 000000000..1e1b2a5e7 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/sessions/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import SessionsTransport +from .grpc import SessionsGrpcTransport +from .grpc_asyncio import SessionsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[SessionsTransport]] +_transport_registry["grpc"] = SessionsGrpcTransport +_transport_registry["grpc_asyncio"] = SessionsGrpcAsyncIOTransport + + +__all__ = ( + "SessionsTransport", + "SessionsGrpcTransport", + "SessionsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2/services/sessions/transports/base.py b/google/cloud/dialogflow_v2/services/sessions/transports/base.py new file mode 100644 index 000000000..c29e65fe1 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/sessions/transports/base.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2.types import session +from google.cloud.dialogflow_v2.types import session as gcd_session + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class SessionsTransport(abc.ABC): + """Abstract transport class for Sessions.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.detect_intent: gapic_v1.method.wrap_method( + self.detect_intent, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), + ), + default_timeout=220.0, + client_info=client_info, + ), + self.streaming_detect_intent: gapic_v1.method.wrap_method( + self.streaming_detect_intent, + default_timeout=220.0, + client_info=client_info, + ), + } + + @property + def detect_intent( + self, + ) -> typing.Callable[ + [gcd_session.DetectIntentRequest], + typing.Union[ + gcd_session.DetectIntentResponse, + typing.Awaitable[gcd_session.DetectIntentResponse], + ], + ]: + raise NotImplementedError() + + @property + def streaming_detect_intent( + self, + ) -> typing.Callable[ + [session.StreamingDetectIntentRequest], + typing.Union[ + session.StreamingDetectIntentResponse, + typing.Awaitable[session.StreamingDetectIntentResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("SessionsTransport",) diff --git a/google/cloud/dialogflow_v2/services/sessions/transports/grpc.py b/google/cloud/dialogflow_v2/services/sessions/transports/grpc.py new file mode 100644 index 000000000..c622d43b7 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/sessions/transports/grpc.py @@ -0,0 +1,305 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2.types import session +from google.cloud.dialogflow_v2.types import session as gcd_session + +from .base import SessionsTransport, DEFAULT_CLIENT_INFO + + +class SessionsGrpcTransport(SessionsTransport): + """gRPC backend transport for Sessions. + + A service used for session interactions. + + For more information, see the `API interactions + guide `__. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def detect_intent( + self, + ) -> Callable[[gcd_session.DetectIntentRequest], gcd_session.DetectIntentResponse]: + r"""Return a callable for the detect intent method over gRPC. + + Processes a natural language query and returns structured, + actionable data as a result. This method is not idempotent, + because it may cause contexts and session entity types to be + updated, which in turn might affect results of future queries. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Returns: + Callable[[~.DetectIntentRequest], + ~.DetectIntentResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "detect_intent" not in self._stubs: + self._stubs["detect_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Sessions/DetectIntent", + request_serializer=gcd_session.DetectIntentRequest.serialize, + response_deserializer=gcd_session.DetectIntentResponse.deserialize, + ) + return self._stubs["detect_intent"] + + @property + def streaming_detect_intent( + self, + ) -> Callable[ + [session.StreamingDetectIntentRequest], session.StreamingDetectIntentResponse + ]: + r"""Return a callable for the streaming detect intent method over gRPC. + + Processes a natural language query in audio format in a + streaming fashion and returns structured, actionable data as a + result. This method is only available via the gRPC API (not + REST). + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Returns: + Callable[[~.StreamingDetectIntentRequest], + ~.StreamingDetectIntentResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "streaming_detect_intent" not in self._stubs: + self._stubs["streaming_detect_intent"] = self.grpc_channel.stream_stream( + "/google.cloud.dialogflow.v2.Sessions/StreamingDetectIntent", + request_serializer=session.StreamingDetectIntentRequest.serialize, + response_deserializer=session.StreamingDetectIntentResponse.deserialize, + ) + return self._stubs["streaming_detect_intent"] + + +__all__ = ("SessionsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2/services/sessions/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2/services/sessions/transports/grpc_asyncio.py new file mode 100644 index 000000000..9e9b7dea6 --- /dev/null +++ b/google/cloud/dialogflow_v2/services/sessions/transports/grpc_asyncio.py @@ -0,0 +1,312 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2.types import session +from google.cloud.dialogflow_v2.types import session as gcd_session + +from .base import SessionsTransport, DEFAULT_CLIENT_INFO +from .grpc import SessionsGrpcTransport + + +class SessionsGrpcAsyncIOTransport(SessionsTransport): + """gRPC AsyncIO backend transport for Sessions. + + A service used for session interactions. + + For more information, see the `API interactions + guide `__. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def detect_intent( + self, + ) -> Callable[ + [gcd_session.DetectIntentRequest], Awaitable[gcd_session.DetectIntentResponse] + ]: + r"""Return a callable for the detect intent method over gRPC. + + Processes a natural language query and returns structured, + actionable data as a result. This method is not idempotent, + because it may cause contexts and session entity types to be + updated, which in turn might affect results of future queries. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Returns: + Callable[[~.DetectIntentRequest], + Awaitable[~.DetectIntentResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "detect_intent" not in self._stubs: + self._stubs["detect_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2.Sessions/DetectIntent", + request_serializer=gcd_session.DetectIntentRequest.serialize, + response_deserializer=gcd_session.DetectIntentResponse.deserialize, + ) + return self._stubs["detect_intent"] + + @property + def streaming_detect_intent( + self, + ) -> Callable[ + [session.StreamingDetectIntentRequest], + Awaitable[session.StreamingDetectIntentResponse], + ]: + r"""Return a callable for the streaming detect intent method over gRPC. + + Processes a natural language query in audio format in a + streaming fashion and returns structured, actionable data as a + result. This method is only available via the gRPC API (not + REST). + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Returns: + Callable[[~.StreamingDetectIntentRequest], + Awaitable[~.StreamingDetectIntentResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "streaming_detect_intent" not in self._stubs: + self._stubs["streaming_detect_intent"] = self.grpc_channel.stream_stream( + "/google.cloud.dialogflow.v2.Sessions/StreamingDetectIntent", + request_serializer=session.StreamingDetectIntentRequest.serialize, + response_deserializer=session.StreamingDetectIntentResponse.deserialize, + ) + return self._stubs["streaming_detect_intent"] + + +__all__ = ("SessionsGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2/types/__init__.py b/google/cloud/dialogflow_v2/types/__init__.py new file mode 100644 index 000000000..7906d41e7 --- /dev/null +++ b/google/cloud/dialogflow_v2/types/__init__.py @@ -0,0 +1,199 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .validation_result import ( + ValidationError, + ValidationResult, +) +from .agent import ( + Agent, + GetAgentRequest, + SetAgentRequest, + DeleteAgentRequest, + SearchAgentsRequest, + SearchAgentsResponse, + TrainAgentRequest, + ExportAgentRequest, + ExportAgentResponse, + ImportAgentRequest, + RestoreAgentRequest, + GetValidationResultRequest, +) +from .audio_config import ( + SpeechContext, + SpeechWordInfo, + InputAudioConfig, + VoiceSelectionParams, + SynthesizeSpeechConfig, + OutputAudioConfig, +) +from .context import ( + Context, + ListContextsRequest, + ListContextsResponse, + GetContextRequest, + CreateContextRequest, + UpdateContextRequest, + DeleteContextRequest, + DeleteAllContextsRequest, +) +from .entity_type import ( + EntityType, + ListEntityTypesRequest, + ListEntityTypesResponse, + GetEntityTypeRequest, + CreateEntityTypeRequest, + UpdateEntityTypeRequest, + DeleteEntityTypeRequest, + BatchUpdateEntityTypesRequest, + BatchUpdateEntityTypesResponse, + BatchDeleteEntityTypesRequest, + BatchCreateEntitiesRequest, + BatchUpdateEntitiesRequest, + BatchDeleteEntitiesRequest, + EntityTypeBatch, +) +from .environment import ( + Environment, + ListEnvironmentsRequest, + ListEnvironmentsResponse, +) +from .intent import ( + Intent, + ListIntentsRequest, + ListIntentsResponse, + GetIntentRequest, + CreateIntentRequest, + UpdateIntentRequest, + DeleteIntentRequest, + BatchUpdateIntentsRequest, + BatchUpdateIntentsResponse, + BatchDeleteIntentsRequest, + IntentBatch, +) +from .session_entity_type import ( + SessionEntityType, + ListSessionEntityTypesRequest, + ListSessionEntityTypesResponse, + GetSessionEntityTypeRequest, + CreateSessionEntityTypeRequest, + UpdateSessionEntityTypeRequest, + DeleteSessionEntityTypeRequest, +) +from .session import ( + DetectIntentRequest, + DetectIntentResponse, + QueryParameters, + QueryInput, + QueryResult, + StreamingDetectIntentRequest, + StreamingDetectIntentResponse, + StreamingRecognitionResult, + TextInput, + EventInput, + SentimentAnalysisRequestConfig, + SentimentAnalysisResult, + Sentiment, +) +from .webhook import ( + WebhookRequest, + WebhookResponse, + OriginalDetectIntentRequest, +) + + +__all__ = ( + "ValidationError", + "ValidationResult", + "Agent", + "GetAgentRequest", + "SetAgentRequest", + "DeleteAgentRequest", + "SearchAgentsRequest", + "SearchAgentsResponse", + "TrainAgentRequest", + "ExportAgentRequest", + "ExportAgentResponse", + "ImportAgentRequest", + "RestoreAgentRequest", + "GetValidationResultRequest", + "SpeechContext", + "SpeechWordInfo", + "InputAudioConfig", + "VoiceSelectionParams", + "SynthesizeSpeechConfig", + "OutputAudioConfig", + "Context", + "ListContextsRequest", + "ListContextsResponse", + "GetContextRequest", + "CreateContextRequest", + "UpdateContextRequest", + "DeleteContextRequest", + "DeleteAllContextsRequest", + "EntityType", + "ListEntityTypesRequest", + "ListEntityTypesResponse", + "GetEntityTypeRequest", + "CreateEntityTypeRequest", + "UpdateEntityTypeRequest", + "DeleteEntityTypeRequest", + "BatchUpdateEntityTypesRequest", + "BatchUpdateEntityTypesResponse", + "BatchDeleteEntityTypesRequest", + "BatchCreateEntitiesRequest", + "BatchUpdateEntitiesRequest", + "BatchDeleteEntitiesRequest", + "EntityTypeBatch", + "Environment", + "ListEnvironmentsRequest", + "ListEnvironmentsResponse", + "Intent", + "ListIntentsRequest", + "ListIntentsResponse", + "GetIntentRequest", + "CreateIntentRequest", + "UpdateIntentRequest", + "DeleteIntentRequest", + "BatchUpdateIntentsRequest", + "BatchUpdateIntentsResponse", + "BatchDeleteIntentsRequest", + "IntentBatch", + "SessionEntityType", + "ListSessionEntityTypesRequest", + "ListSessionEntityTypesResponse", + "GetSessionEntityTypeRequest", + "CreateSessionEntityTypeRequest", + "UpdateSessionEntityTypeRequest", + "DeleteSessionEntityTypeRequest", + "DetectIntentRequest", + "DetectIntentResponse", + "QueryParameters", + "QueryInput", + "QueryResult", + "StreamingDetectIntentRequest", + "StreamingDetectIntentResponse", + "StreamingRecognitionResult", + "TextInput", + "EventInput", + "SentimentAnalysisRequestConfig", + "SentimentAnalysisResult", + "Sentiment", + "WebhookRequest", + "WebhookResponse", + "OriginalDetectIntentRequest", +) diff --git a/google/cloud/dialogflow_v2/types/agent.py b/google/cloud/dialogflow_v2/types/agent.py new file mode 100644 index 000000000..721c5dc90 --- /dev/null +++ b/google/cloud/dialogflow_v2/types/agent.py @@ -0,0 +1,371 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2", + manifest={ + "Agent", + "GetAgentRequest", + "SetAgentRequest", + "DeleteAgentRequest", + "SearchAgentsRequest", + "SearchAgentsResponse", + "TrainAgentRequest", + "ExportAgentRequest", + "ExportAgentResponse", + "ImportAgentRequest", + "RestoreAgentRequest", + "GetValidationResultRequest", + }, +) + + +class Agent(proto.Message): + r"""A Dialogflow agent is a virtual agent that handles conversations + with your end-users. It is a natural language understanding module + that understands the nuances of human language. Dialogflow + translates end-user text or audio during a conversation to + structured data that your apps and services can understand. You + design and build a Dialogflow agent to handle the types of + conversations required for your system. + + For more information about agents, see the `Agent + guide `__. + + Attributes: + parent (str): + Required. The project of this agent. Format: + ``projects/``. + display_name (str): + Required. The name of this agent. + default_language_code (str): + Required. The default language of the agent as a language + tag. See `Language + Support `__ + for a list of the currently supported language codes. This + field cannot be set by the ``Update`` method. + supported_language_codes (Sequence[str]): + Optional. The list of all languages supported by this agent + (except for the ``default_language_code``). + time_zone (str): + Required. The time zone of this agent from the `time zone + database `__, e.g., + America/New_York, Europe/Paris. + description (str): + Optional. The description of this agent. + The maximum length is 500 characters. If + exceeded, the request is rejected. + avatar_uri (str): + Optional. The URI of the agent's avatar. Avatars are used + throughout the Dialogflow console and in the self-hosted + `Web + Demo `__ + integration. + enable_logging (bool): + Optional. Determines whether this agent + should log conversation queries. + match_mode (~.gcd_agent.Agent.MatchMode): + Optional. Determines how intents are detected + from user queries. + classification_threshold (float): + Optional. To filter out false positive + results and still get variety in matched natural + language inputs for your agent, you can tune the + machine learning classification threshold. If + the returned score value is less than the + threshold value, then a fallback intent will be + triggered or, if there are no fallback intents + defined, no intent will be triggered. The score + values range from 0.0 (completely uncertain) to + 1.0 (completely certain). If set to 0.0, the + default of 0.3 is used. + api_version (~.gcd_agent.Agent.ApiVersion): + Optional. API version displayed in Dialogflow + console. If not specified, V2 API is assumed. + Clients are free to query different service + endpoints for different API versions. However, + bots connectors and webhook calls will follow + the specified API version. + tier (~.gcd_agent.Agent.Tier): + Optional. The agent tier. If not specified, TIER_STANDARD is + assumed. + """ + + class MatchMode(proto.Enum): + r"""Match mode determines how intents are detected from user + queries. + """ + MATCH_MODE_UNSPECIFIED = 0 + MATCH_MODE_HYBRID = 1 + MATCH_MODE_ML_ONLY = 2 + + class ApiVersion(proto.Enum): + r"""API version for the agent.""" + API_VERSION_UNSPECIFIED = 0 + API_VERSION_V1 = 1 + API_VERSION_V2 = 2 + API_VERSION_V2_BETA_1 = 3 + + class Tier(proto.Enum): + r"""Represents the agent tier.""" + TIER_UNSPECIFIED = 0 + TIER_STANDARD = 1 + TIER_ENTERPRISE = 2 + TIER_ENTERPRISE_PLUS = 3 + + parent = 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) + + enable_logging = proto.Field(proto.BOOL, number=8) + + match_mode = proto.Field(proto.ENUM, number=9, enum=MatchMode,) + + classification_threshold = proto.Field(proto.FLOAT, number=10) + + api_version = proto.Field(proto.ENUM, number=14, enum=ApiVersion,) + + tier = proto.Field(proto.ENUM, number=15, enum=Tier,) + + +class GetAgentRequest(proto.Message): + r"""The request message for + [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent]. + + Attributes: + parent (str): + Required. The project that the agent to fetch is associated + with. Format: ``projects/``. + """ + + parent = proto.Field(proto.STRING, number=1) + + +class SetAgentRequest(proto.Message): + r"""The request message for + [Agents.SetAgent][google.cloud.dialogflow.v2.Agents.SetAgent]. + + Attributes: + agent (~.gcd_agent.Agent): + Required. The agent to update. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + """ + + agent = proto.Field(proto.MESSAGE, number=1, message="Agent",) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteAgentRequest(proto.Message): + r"""The request message for + [Agents.DeleteAgent][google.cloud.dialogflow.v2.Agents.DeleteAgent]. + + Attributes: + parent (str): + Required. The project that the agent to delete is associated + with. Format: ``projects/``. + """ + + parent = proto.Field(proto.STRING, number=1) + + +class SearchAgentsRequest(proto.Message): + r"""The request message for + [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. + + Attributes: + parent (str): + Required. The project to list agents from. Format: + ``projects/``. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + The next_page_token value returned from a previous list + request. + """ + + parent = proto.Field(proto.STRING, number=1) + + page_size = proto.Field(proto.INT32, number=2) + + page_token = proto.Field(proto.STRING, number=3) + + +class SearchAgentsResponse(proto.Message): + r"""The response message for + [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. + + Attributes: + agents (Sequence[~.gcd_agent.Agent]): + The list of agents. There will be a maximum number of items + returned based on the page_size field in the request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + agents = proto.RepeatedField(proto.MESSAGE, number=1, message="Agent",) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class TrainAgentRequest(proto.Message): + r"""The request message for + [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent]. + + Attributes: + parent (str): + Required. The project that the agent to train is associated + with. Format: ``projects/``. + """ + + parent = proto.Field(proto.STRING, number=1) + + +class ExportAgentRequest(proto.Message): + r"""The request message for + [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. + + Attributes: + parent (str): + Required. The project that the agent to export is associated + with. Format: ``projects/``. + agent_uri (str): + Required. The `Google Cloud + Storage `__ URI to + export the agent to. The format of this URI must be + ``gs:///``. If left unspecified, + the serialized agent is returned inline. + """ + + parent = proto.Field(proto.STRING, number=1) + + agent_uri = proto.Field(proto.STRING, number=2) + + +class ExportAgentResponse(proto.Message): + r"""The response message for + [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. + + Attributes: + agent_uri (str): + The URI to a file containing the exported agent. This field + is populated only if ``agent_uri`` is specified in + ``ExportAgentRequest``. + agent_content (bytes): + Zip compressed raw byte content for agent. + """ + + agent_uri = proto.Field(proto.STRING, number=1, oneof="agent") + + agent_content = proto.Field(proto.BYTES, number=2, oneof="agent") + + +class ImportAgentRequest(proto.Message): + r"""The request message for + [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent]. + + Attributes: + parent (str): + Required. The project that the agent to import is associated + with. Format: ``projects/``. + agent_uri (str): + The URI to a Google Cloud Storage file + containing the agent to import. Note: The URI + must start with "gs://". + agent_content (bytes): + Zip compressed raw byte content for agent. + """ + + parent = 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") + + +class RestoreAgentRequest(proto.Message): + r"""The request message for + [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent]. + + Attributes: + parent (str): + Required. The project that the agent to restore is + associated with. Format: ``projects/``. + agent_uri (str): + The URI to a Google Cloud Storage file + containing the agent to restore. Note: The URI + must start with "gs://". + agent_content (bytes): + Zip compressed raw byte content for agent. + """ + + parent = 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") + + +class GetValidationResultRequest(proto.Message): + r"""The request message for + [Agents.GetValidationResult][google.cloud.dialogflow.v2.Agents.GetValidationResult]. + + Attributes: + parent (str): + Required. The project that the agent is associated with. + Format: ``projects/``. + language_code (str): + Optional. The language for which you want a validation + result. If not specified, the agent's default language is + used. `Many + languages `__ + are supported. Note: languages must be enabled in the agent + before they can be used. + """ + + parent = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=3) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2/types/audio_config.py b/google/cloud/dialogflow_v2/types/audio_config.py new file mode 100644 index 000000000..1ecf86bed --- /dev/null +++ b/google/cloud/dialogflow_v2/types/audio_config.py @@ -0,0 +1,372 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import duration_pb2 as duration # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2", + manifest={ + "AudioEncoding", + "SpeechModelVariant", + "SsmlVoiceGender", + "OutputAudioEncoding", + "SpeechContext", + "SpeechWordInfo", + "InputAudioConfig", + "VoiceSelectionParams", + "SynthesizeSpeechConfig", + "OutputAudioConfig", + }, +) + + +class AudioEncoding(proto.Enum): + r"""Audio encoding of the audio content sent in the conversational query + request. Refer to the `Cloud Speech API + documentation `__ + for more details. + """ + AUDIO_ENCODING_UNSPECIFIED = 0 + AUDIO_ENCODING_LINEAR_16 = 1 + AUDIO_ENCODING_FLAC = 2 + AUDIO_ENCODING_MULAW = 3 + AUDIO_ENCODING_AMR = 4 + AUDIO_ENCODING_AMR_WB = 5 + AUDIO_ENCODING_OGG_OPUS = 6 + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 + + +class SpeechModelVariant(proto.Enum): + r"""Variant of the specified [Speech + model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use. + + See the `Cloud Speech + documentation `__ + for which models have different variants. For example, the + "phone_call" model has both a standard and an enhanced variant. When + you use an enhanced model, you will generally receive higher quality + results than for a standard model. + """ + SPEECH_MODEL_VARIANT_UNSPECIFIED = 0 + USE_BEST_AVAILABLE = 1 + USE_STANDARD = 2 + USE_ENHANCED = 3 + + +class SsmlVoiceGender(proto.Enum): + r"""Gender of the voice as described in `SSML voice + element `__. + """ + SSML_VOICE_GENDER_UNSPECIFIED = 0 + SSML_VOICE_GENDER_MALE = 1 + SSML_VOICE_GENDER_FEMALE = 2 + SSML_VOICE_GENDER_NEUTRAL = 3 + + +class OutputAudioEncoding(proto.Enum): + r"""Audio encoding of the output audio format in Text-To-Speech.""" + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0 + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1 + OUTPUT_AUDIO_ENCODING_MP3 = 2 + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3 + + +class SpeechContext(proto.Message): + r"""Hints for the speech recognizer to help with recognition in a + specific conversation state. + + Attributes: + phrases (Sequence[str]): + Optional. A list of strings containing words and phrases + that the speech recognizer should recognize with higher + likelihood. + + This list can be used to: + + - improve accuracy for words and phrases you expect the + user to say, e.g. typical commands for your Dialogflow + agent + - add additional words to the speech recognizer vocabulary + - ... + + See the `Cloud Speech + documentation `__ + for usage limits. + boost (float): + Optional. Boost for this context compared to other contexts: + + - If the boost is positive, Dialogflow will increase the + probability that the phrases in this context are + recognized over similar sounding phrases. + - If the boost is unspecified or non-positive, Dialogflow + will not apply any boost. + + Dialogflow recommends that you use boosts in the range (0, + 20] and that you find a value that fits your use case with + binary search. + """ + + phrases = proto.RepeatedField(proto.STRING, number=1) + + boost = proto.Field(proto.FLOAT, number=2) + + +class SpeechWordInfo(proto.Message): + r"""Information for a word recognized by the speech recognizer. + + Attributes: + word (str): + The word this info is for. + start_offset (~.duration.Duration): + Time offset relative to the beginning of the + audio that corresponds to the start of the + spoken word. This is an experimental feature and + the accuracy of the time offset can vary. + end_offset (~.duration.Duration): + Time offset relative to the beginning of the + audio that corresponds to the end of the spoken + word. This is an experimental feature and the + accuracy of the time offset can vary. + confidence (float): + The Speech confidence between 0.0 and 1.0 for + this word. A higher number indicates an + estimated greater likelihood that the recognized + word is correct. The default of 0.0 is a + sentinel value indicating that confidence was + not set. + + This field is not guaranteed to be fully stable + over time for the same audio input. Users should + 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.Duration,) + + end_offset = proto.Field(proto.MESSAGE, number=2, message=duration.Duration,) + + confidence = proto.Field(proto.FLOAT, number=4) + + +class InputAudioConfig(proto.Message): + r"""Instructs the speech recognizer how to process the audio + content. + + Attributes: + audio_encoding (~.audio_config.AudioEncoding): + Required. Audio encoding of the audio content + to process. + sample_rate_hertz (int): + Required. Sample rate (in Hertz) of the audio content sent + in the query. Refer to `Cloud Speech API + documentation `__ + for more details. + language_code (str): + Required. The language of the supplied audio. Dialogflow + does not do translations. See `Language + Support `__ + for a list of the currently supported language codes. Note + that queries in the same session do not necessarily need to + specify the same language. + enable_word_info (bool): + If ``true``, Dialogflow returns + [SpeechWordInfo][google.cloud.dialogflow.v2.SpeechWordInfo] + in + [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult] + with information about the recognized speech words, e.g. + start and end time offsets. If false or unspecified, Speech + doesn't return any word-level information. + phrase_hints (Sequence[str]): + A list of strings containing words and phrases that the + speech recognizer should recognize with higher likelihood. + + See `the Cloud Speech + documentation `__ + for more details. + + This field is deprecated. Please use `speech_contexts <>`__ + instead. If you specify both `phrase_hints <>`__ and + `speech_contexts <>`__, Dialogflow will treat the + `phrase_hints <>`__ as a single additional + `SpeechContext <>`__. + speech_contexts (Sequence[~.audio_config.SpeechContext]): + Context information to assist speech recognition. + + See `the Cloud Speech + documentation `__ + for more details. + model (str): + Which Speech model to select for the given request. Select + the model best suited to your domain to get best results. If + a model is not explicitly specified, then we auto-select a + model based on the parameters in the InputAudioConfig. If + enhanced speech model is enabled for the agent and an + enhanced version of the specified model for the language + does not exist, then the speech is recognized using the + standard version of the specified model. Refer to `Cloud + Speech API + documentation `__ + for more details. + model_variant (~.audio_config.SpeechModelVariant): + Which variant of the [Speech + model][google.cloud.dialogflow.v2.InputAudioConfig.model] to + use. + single_utterance (bool): + If ``false`` (default), recognition does not cease until the + client closes the stream. If ``true``, the recognizer will + detect a single spoken utterance in input audio. Recognition + ceases when it detects the audio's voice has stopped or + paused. In this case, once a detected intent is received, + the client should close the stream and start a new request + with a new stream as needed. Note: This setting is relevant + only for streaming methods. Note: When specified, + InputAudioConfig.single_utterance takes precedence over + StreamingDetectIntentRequest.single_utterance. + """ + + audio_encoding = proto.Field(proto.ENUM, number=1, enum="AudioEncoding",) + + sample_rate_hertz = proto.Field(proto.INT32, number=2) + + language_code = proto.Field(proto.STRING, number=3) + + enable_word_info = proto.Field(proto.BOOL, number=13) + + phrase_hints = proto.RepeatedField(proto.STRING, number=4) + + speech_contexts = proto.RepeatedField( + proto.MESSAGE, number=11, message="SpeechContext", + ) + + 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): + r"""Description of which voice to use for speech synthesis. + + Attributes: + name (str): + Optional. The name of the voice. If not set, the service + will choose a voice based on the other parameters such as + language_code and + [ssml_gender][google.cloud.dialogflow.v2.VoiceSelectionParams.ssml_gender]. + ssml_gender (~.audio_config.SsmlVoiceGender): + Optional. The preferred gender of the voice. If not set, the + service will choose a voice based on the other parameters + such as language_code and + [name][google.cloud.dialogflow.v2.VoiceSelectionParams.name]. + Note that this is only a preference, not requirement. If a + voice of the appropriate gender is not available, the + synthesizer should substitute a voice with a different + gender rather than failing the request. + """ + + name = proto.Field(proto.STRING, number=1) + + ssml_gender = proto.Field(proto.ENUM, number=2, enum="SsmlVoiceGender",) + + +class SynthesizeSpeechConfig(proto.Message): + r"""Configuration of how speech should be synthesized. + + Attributes: + speaking_rate (float): + Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 + is the normal native speed supported by the specific voice. + 2.0 is twice as fast, and 0.5 is half as fast. If + unset(0.0), defaults to the native 1.0 speed. Any other + values < 0.25 or > 4.0 will return an error. + pitch (float): + Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 + means increase 20 semitones from the original pitch. -20 + means decrease 20 semitones from the original pitch. + volume_gain_db (float): + Optional. Volume gain (in dB) of the normal native volume + supported by the specific voice, in the range [-96.0, 16.0]. + If unset, or set to a value of 0.0 (dB), will play at normal + native signal amplitude. A value of -6.0 (dB) will play at + approximately half the amplitude of the normal native signal + amplitude. A value of +6.0 (dB) will play at approximately + twice the amplitude of the normal native signal amplitude. + We strongly recommend not to exceed +10 (dB) as there's + usually no effective increase in loudness for any value + greater than that. + effects_profile_id (Sequence[str]): + Optional. An identifier which selects 'audio + effects' profiles that are applied on (post + synthesized) text to speech. Effects are applied + on top of each other in the order they are + given. + voice (~.audio_config.VoiceSelectionParams): + Optional. The desired voice of the + 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",) + + +class OutputAudioConfig(proto.Message): + r"""Instructs the speech synthesizer on how to generate the + output audio content. If this audio config is supplied in a + request, it overrides all existing text-to-speech settings + applied to the agent. + + Attributes: + audio_encoding (~.audio_config.OutputAudioEncoding): + Required. Audio encoding of the synthesized + audio content. + sample_rate_hertz (int): + The synthesis sample rate (in hertz) for this + audio. If not provided, then the synthesizer + will use the default sample rate based on the + audio encoding. If this is different from the + voice's natural sample rate, then the + synthesizer will honor this request by + converting to the desired sample rate (which + might result in worse audio quality). + synthesize_speech_config (~.audio_config.SynthesizeSpeechConfig): + Configuration of how speech should be + synthesized. + """ + + 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", + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2/types/context.py b/google/cloud/dialogflow_v2/types/context.py new file mode 100644 index 000000000..271978476 --- /dev/null +++ b/google/cloud/dialogflow_v2/types/context.py @@ -0,0 +1,257 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2", + manifest={ + "Context", + "ListContextsRequest", + "ListContextsResponse", + "GetContextRequest", + "CreateContextRequest", + "UpdateContextRequest", + "DeleteContextRequest", + "DeleteAllContextsRequest", + }, +) + + +class Context(proto.Message): + r"""Dialogflow contexts are similar to natural language context. If a + person says to you "they are orange", you need context in order to + understand what "they" is referring to. Similarly, for Dialogflow to + handle an end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a conversation. You can + configure contexts for an intent by setting input and output + contexts, which are identified by string names. When an intent is + matched, any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is more likely to + match intents that are configured with input contexts that + correspond to the currently active contexts. + + For more information about context, see the `Contexts + guide `__. + + Attributes: + name (str): + Required. The unique identifier of the context. Format: + ``projects//agent/sessions//contexts/``, + or + ``projects//agent/environments//users//sessions//contexts/``. + + The ``Context ID`` is always converted to lowercase, may + only contain characters in a-zA-Z0-9_-% and may be at most + 250 bytes long. + + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + + The following context names are reserved for internal use by + Dialogflow. You should not use these contexts or create + contexts with these names: + + - ``__system_counters__`` + - ``*_id_dialog_context`` + - ``*_dialog_params_size`` + lifespan_count (int): + Optional. The number of conversational query requests after + which the context expires. The default is ``0``. If set to + ``0``, the context expires immediately. Contexts expire + automatically after 20 minutes if there are no matching + queries. + parameters (~.struct.Struct): + Optional. The collection of parameters + associated with this context. + 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: string or + number, depending on parameter value type - + MapValue value: + - If parameter's entity type is a + composite entity: map from composite + entity property names to property values - + Else: parameter value + """ + + name = proto.Field(proto.STRING, number=1) + + lifespan_count = proto.Field(proto.INT32, number=2) + + parameters = proto.Field(proto.MESSAGE, number=3, message=struct.Struct,) + + +class ListContextsRequest(proto.Message): + r"""The request message for + [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. + + Attributes: + parent (str): + Required. The session to list all contexts from. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list request. + """ + + parent = proto.Field(proto.STRING, number=1) + + page_size = proto.Field(proto.INT32, number=2) + + page_token = proto.Field(proto.STRING, number=3) + + +class ListContextsResponse(proto.Message): + r"""The response message for + [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. + + Attributes: + contexts (Sequence[~.gcd_context.Context]): + The list of contexts. There will be a maximum number of + items returned based on the page_size field in the request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + contexts = proto.RepeatedField(proto.MESSAGE, number=1, message="Context",) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class GetContextRequest(proto.Message): + r"""The request message for + [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext]. + + Attributes: + name (str): + Required. The name of the context. Format: + ``projects//agent/sessions//contexts/`` + or + ``projects//agent/environments//users//sessions//contexts/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + """ + + name = proto.Field(proto.STRING, number=1) + + +class CreateContextRequest(proto.Message): + r"""The request message for + [Contexts.CreateContext][google.cloud.dialogflow.v2.Contexts.CreateContext]. + + Attributes: + parent (str): + Required. The session to create a context for. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + context (~.gcd_context.Context): + Required. The context to create. + """ + + parent = proto.Field(proto.STRING, number=1) + + context = proto.Field(proto.MESSAGE, number=2, message="Context",) + + +class UpdateContextRequest(proto.Message): + r"""The request message for + [Contexts.UpdateContext][google.cloud.dialogflow.v2.Contexts.UpdateContext]. + + Attributes: + context (~.gcd_context.Context): + Required. The context to update. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + """ + + context = proto.Field(proto.MESSAGE, number=1, message="Context",) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteContextRequest(proto.Message): + r"""The request message for + [Contexts.DeleteContext][google.cloud.dialogflow.v2.Contexts.DeleteContext]. + + Attributes: + name (str): + Required. The name of the context to delete. Format: + ``projects//agent/sessions//contexts/`` + or + ``projects//agent/environments//users//sessions//contexts/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + """ + + name = proto.Field(proto.STRING, number=1) + + +class DeleteAllContextsRequest(proto.Message): + r"""The request message for + [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2.Contexts.DeleteAllContexts]. + + Attributes: + parent (str): + Required. The name of the session to delete all contexts + from. Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + """ + + parent = proto.Field(proto.STRING, number=1) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2/types/entity_type.py b/google/cloud/dialogflow_v2/types/entity_type.py new file mode 100644 index 000000000..156cb1609 --- /dev/null +++ b/google/cloud/dialogflow_v2/types/entity_type.py @@ -0,0 +1,459 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2", + manifest={ + "EntityType", + "ListEntityTypesRequest", + "ListEntityTypesResponse", + "GetEntityTypeRequest", + "CreateEntityTypeRequest", + "UpdateEntityTypeRequest", + "DeleteEntityTypeRequest", + "BatchUpdateEntityTypesRequest", + "BatchUpdateEntityTypesResponse", + "BatchDeleteEntityTypesRequest", + "BatchCreateEntitiesRequest", + "BatchUpdateEntitiesRequest", + "BatchDeleteEntitiesRequest", + "EntityTypeBatch", + }, +) + + +class EntityType(proto.Message): + r"""Each intent parameter has a type, called the entity type, which + dictates exactly how data from an end-user expression is extracted. + + Dialogflow provides predefined system entities that can match many + common types of data. For example, there are system entities for + matching dates, times, colors, email addresses, and so on. You can + also create your own custom entities for matching custom data. For + example, you could define a vegetable entity that can match the + types of vegetables available for purchase with a grocery store + agent. + + For more information, see the `Entity + guide `__. + + Attributes: + name (str): + The unique identifier of the entity type. Required for + [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType] + and + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes] + methods. Format: + ``projects//agent/entityTypes/``. + display_name (str): + Required. The name of the entity type. + kind (~.gcd_entity_type.EntityType.Kind): + Required. Indicates the kind of entity type. + auto_expansion_mode (~.gcd_entity_type.EntityType.AutoExpansionMode): + Optional. Indicates whether the entity type + can be automatically expanded. + entities (Sequence[~.gcd_entity_type.EntityType.Entity]): + Optional. The collection of entity entries + associated with the entity type. + enable_fuzzy_extraction (bool): + Optional. Enables fuzzy entity extraction + during classification. + """ + + class Kind(proto.Enum): + r"""Represents kinds of entities.""" + KIND_UNSPECIFIED = 0 + KIND_MAP = 1 + KIND_LIST = 2 + KIND_REGEXP = 3 + + class AutoExpansionMode(proto.Enum): + r"""Represents different entity type expansion modes. Automated + expansion allows an agent to recognize values that have not been + explicitly listed in the entity (for example, new kinds of + shopping list items). + """ + AUTO_EXPANSION_MODE_UNSPECIFIED = 0 + AUTO_EXPANSION_MODE_DEFAULT = 1 + + class Entity(proto.Message): + r"""An **entity entry** for an associated entity type. + + Attributes: + value (str): + Required. The primary value associated with this entity + entry. For example, if the entity type is *vegetable*, the + value could be *scallions*. + + For ``KIND_MAP`` entity types: + + - A reference value to be used in place of synonyms. + + For ``KIND_LIST`` entity types: + + - A string that can contain references to other entity + types (with or without aliases). + synonyms (Sequence[str]): + Required. A collection of value synonyms. For example, if + the entity type is *vegetable*, and ``value`` is + *scallions*, a synonym could be *green onions*. + + For ``KIND_LIST`` entity types: + + - This collection must contain exactly one synonym equal to + ``value``. + """ + + value = proto.Field(proto.STRING, number=1) + + synonyms = proto.RepeatedField(proto.STRING, number=2) + + 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=6, message=Entity,) + + enable_fuzzy_extraction = proto.Field(proto.BOOL, number=7) + + +class ListEntityTypesRequest(proto.Message): + r"""The request message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. + + Attributes: + parent (str): + Required. The agent to list all entity types from. Format: + ``projects//agent``. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list 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) + + +class ListEntityTypesResponse(proto.Message): + r"""The response message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. + + Attributes: + entity_types (Sequence[~.gcd_entity_type.EntityType]): + The list of agent entity types. There will be a maximum + number of items returned based on the page_size field in the + request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + 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) + + +class GetEntityTypeRequest(proto.Message): + r"""The request message for + [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType]. + + Attributes: + name (str): + Required. The name of the entity type. Format: + ``projects//agent/entityTypes/``. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + """ + + name = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=2) + + +class CreateEntityTypeRequest(proto.Message): + r"""The request message for + [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2.EntityTypes.CreateEntityType]. + + Attributes: + parent (str): + Required. The agent to create a entity type for. Format: + ``projects//agent``. + entity_type (~.gcd_entity_type.EntityType): + Required. The entity type to create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + """ + + 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): + r"""The request message for + [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType]. + + Attributes: + entity_type (~.gcd_entity_type.EntityType): + Required. The entity type to update. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + update_mask (~.field_mask.FieldMask): + Optional. 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) + + update_mask = proto.Field(proto.MESSAGE, number=3, message=field_mask.FieldMask,) + + +class DeleteEntityTypeRequest(proto.Message): + r"""The request message for + [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType]. + + Attributes: + name (str): + Required. The name of the entity type to delete. Format: + ``projects//agent/entityTypes/``. + """ + + name = proto.Field(proto.STRING, number=1) + + +class BatchUpdateEntityTypesRequest(proto.Message): + r"""The request message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. + + Attributes: + parent (str): + Required. The name of the agent to update or create entity + types in. Format: ``projects//agent``. + entity_type_batch_uri (str): + The URI to a Google Cloud Storage file + containing entity types to update or create. The + file format can either be a serialized proto (of + EntityBatch type) or a JSON object. Note: The + URI must start with "gs://". + entity_type_batch_inline (~.gcd_entity_type.EntityTypeBatch): + The collection of entity types to update or + create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + """ + + parent = proto.Field(proto.STRING, number=1) + + entity_type_batch_uri = proto.Field( + proto.STRING, number=2, oneof="entity_type_batch" + ) + + entity_type_batch_inline = proto.Field( + proto.MESSAGE, number=3, oneof="entity_type_batch", message="EntityTypeBatch", + ) + + language_code = proto.Field(proto.STRING, number=4) + + update_mask = proto.Field(proto.MESSAGE, number=5, message=field_mask.FieldMask,) + + +class BatchUpdateEntityTypesResponse(proto.Message): + r"""The response message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. + + Attributes: + entity_types (Sequence[~.gcd_entity_type.EntityType]): + The collection of updated or created entity + types. + """ + + entity_types = proto.RepeatedField(proto.MESSAGE, number=1, message="EntityType",) + + +class BatchDeleteEntityTypesRequest(proto.Message): + r"""The request message for + [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes]. + + Attributes: + parent (str): + Required. The name of the agent to delete all entities types + for. Format: ``projects//agent``. + entity_type_names (Sequence[str]): + Required. The names entity types to delete. All names must + point to the same agent as ``parent``. + """ + + parent = proto.Field(proto.STRING, number=1) + + entity_type_names = proto.RepeatedField(proto.STRING, number=2) + + +class BatchCreateEntitiesRequest(proto.Message): + r"""The request message for + [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities]. + + Attributes: + parent (str): + Required. The name of the entity type to create entities in. + Format: + ``projects//agent/entityTypes/``. + entities (Sequence[~.gcd_entity_type.EntityType.Entity]): + Required. The entities to create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + """ + + parent = proto.Field(proto.STRING, number=1) + + entities = proto.RepeatedField( + proto.MESSAGE, number=2, message="EntityType.Entity", + ) + + language_code = proto.Field(proto.STRING, number=3) + + +class BatchUpdateEntitiesRequest(proto.Message): + r"""The request message for + [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities]. + + Attributes: + parent (str): + Required. The name of the entity type to update or create + entities in. Format: + ``projects//agent/entityTypes/``. + entities (Sequence[~.gcd_entity_type.EntityType.Entity]): + Required. The entities to update or create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + """ + + parent = proto.Field(proto.STRING, number=1) + + entities = proto.RepeatedField( + proto.MESSAGE, number=2, message="EntityType.Entity", + ) + + language_code = proto.Field(proto.STRING, number=3) + + update_mask = proto.Field(proto.MESSAGE, number=4, message=field_mask.FieldMask,) + + +class BatchDeleteEntitiesRequest(proto.Message): + r"""The request message for + [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities]. + + Attributes: + parent (str): + Required. The name of the entity type to delete entries for. + Format: + ``projects//agent/entityTypes/``. + entity_values (Sequence[str]): + Required. The reference ``values`` of the entities to + delete. Note that these are not fully-qualified names, i.e. + they don't start with ``projects/``. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + """ + + parent = proto.Field(proto.STRING, number=1) + + entity_values = proto.RepeatedField(proto.STRING, number=2) + + language_code = proto.Field(proto.STRING, number=3) + + +class EntityTypeBatch(proto.Message): + r"""This message is a wrapper around a collection of entity + types. + + Attributes: + entity_types (Sequence[~.gcd_entity_type.EntityType]): + A collection of entity types. + """ + + entity_types = proto.RepeatedField(proto.MESSAGE, number=1, message="EntityType",) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2/types/environment.py b/google/cloud/dialogflow_v2/types/environment.py new file mode 100644 index 000000000..82fe9ded5 --- /dev/null +++ b/google/cloud/dialogflow_v2/types/environment.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2", + manifest={"Environment", "ListEnvironmentsRequest", "ListEnvironmentsResponse",}, +) + + +class Environment(proto.Message): + r"""You can create multiple versions of your agent and publish them to + separate environments. + + When you edit an agent, you are editing the draft agent. At any + point, you can save the draft agent as an agent version, which is an + immutable snapshot of your agent. + + When you save the draft agent, it is published to the default + environment. When you create agent versions, you can publish them to + custom environments. You can create a variety of custom environments + for: + + - testing + - development + - production + - etc. + + For more information, see the `versions and environments + guide `__. + + Attributes: + name (str): + Output only. The unique identifier of this agent + environment. Format: + ``projects//agent/environments/``. + For Environment ID, "-" is reserved for 'draft' environment. + description (str): + Optional. The developer-provided description + for this environment. The maximum length is 500 + characters. If exceeded, the request is + rejected. + agent_version (str): + Optional. The agent version loaded into this environment. + Format: + ``projects//agent/versions/``. + state (~.environment.Environment.State): + Output only. The state of this environment. + This field is read-only, i.e., it cannot be set + by create and update methods. + update_time (~.timestamp.Timestamp): + Output only. The last update time of this + environment. This field is read-only, i.e., it + cannot be set by create and update methods. + """ + + class State(proto.Enum): + r"""Represents an environment state. When an environment is pointed to a + new agent version, the environment is temporarily set to the + ``LOADING`` state. During that time, the environment keeps on + serving the previous version of the agent. After the new agent + version is done loading, the environment is set back to the + ``RUNNING`` state. + """ + STATE_UNSPECIFIED = 0 + STOPPED = 1 + LOADING = 2 + RUNNING = 3 + + name = proto.Field(proto.STRING, number=1) + + description = proto.Field(proto.STRING, number=2) + + agent_version = proto.Field(proto.STRING, number=3) + + state = proto.Field(proto.ENUM, number=4, enum=State,) + + update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp.Timestamp,) + + +class ListEnvironmentsRequest(proto.Message): + r"""The request message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. + + Attributes: + parent (str): + Required. The agent to list all environments from. Format: + ``projects//agent``. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list request. + """ + + 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): + r"""The response message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. + + Attributes: + environments (Sequence[~.environment.Environment]): + The list of agent environments. There will be a maximum + number of items returned based on the page_size field in the + request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + environments = proto.RepeatedField(proto.MESSAGE, number=1, message="Environment",) + + next_page_token = proto.Field(proto.STRING, number=2) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2/types/intent.py b/google/cloud/dialogflow_v2/types/intent.py new file mode 100644 index 000000000..e16fd8942 --- /dev/null +++ b/google/cloud/dialogflow_v2/types/intent.py @@ -0,0 +1,1351 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.cloud.dialogflow_v2.types import context +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2", + manifest={ + "IntentView", + "Intent", + "ListIntentsRequest", + "ListIntentsResponse", + "GetIntentRequest", + "CreateIntentRequest", + "UpdateIntentRequest", + "DeleteIntentRequest", + "BatchUpdateIntentsRequest", + "BatchUpdateIntentsResponse", + "BatchDeleteIntentsRequest", + "IntentBatch", + }, +) + + +class IntentView(proto.Enum): + r"""Represents the options for views of an intent. + An intent can be a sizable object. Therefore, we provide a + resource view that does not return training phrases in the + response by default. + """ + INTENT_VIEW_UNSPECIFIED = 0 + INTENT_VIEW_FULL = 1 + + +class Intent(proto.Message): + r"""An intent categorizes an end-user's intention for one conversation + turn. For each agent, you define many intents, where your combined + intents can handle a complete conversation. When an end-user writes + or says something, referred to as an end-user expression or end-user + input, Dialogflow matches the end-user input to the best intent in + your agent. Matching an intent is also known as intent + classification. + + For more information, see the `intent + guide `__. + + Attributes: + name (str): + Optional. The unique identifier of this intent. Required for + [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent] + and + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents] + methods. Format: + ``projects//agent/intents/``. + display_name (str): + Required. The name of this intent. + webhook_state (~.gcd_intent.Intent.WebhookState): + Optional. Indicates whether webhooks are + enabled for the intent. + priority (int): + Optional. The priority of this intent. Higher numbers + represent higher priorities. + + - If the supplied value is unspecified or 0, the service + translates the value to 500,000, which corresponds to the + ``Normal`` priority in the console. + - If the supplied value is negative, the intent is ignored + in runtime detect intent requests. + is_fallback (bool): + Optional. Indicates whether this is a + fallback intent. + ml_disabled (bool): + Optional. Indicates whether Machine Learning is disabled for + the intent. Note: If ``ml_disabled`` setting is set to true, + then this intent is not taken into account during inference + in ``ML ONLY`` match mode. Also, auto-markup in the UI is + turned off. + input_context_names (Sequence[str]): + Optional. The list of context names required for this intent + to be triggered. Format: + ``projects//agent/sessions/-/contexts/``. + events (Sequence[str]): + Optional. The collection of event names that + trigger the intent. If the collection of input + contexts is not empty, all of the contexts must + be present in the active user session for an + event to trigger this intent. Event names are + limited to 150 characters. + training_phrases (Sequence[~.gcd_intent.Intent.TrainingPhrase]): + Optional. The collection of examples that the + agent is trained on. + action (str): + Optional. The name of the action associated + with the intent. Note: The action name must not + contain whitespaces. + output_contexts (Sequence[~.context.Context]): + Optional. The collection of contexts that are activated when + the intent is matched. Context messages in this collection + should not set the parameters field. Setting the + ``lifespan_count`` to 0 will reset the context when the + intent is matched. Format: + ``projects//agent/sessions/-/contexts/``. + reset_contexts (bool): + Optional. Indicates whether to delete all + contexts in the current session when this intent + is matched. + parameters (Sequence[~.gcd_intent.Intent.Parameter]): + Optional. The collection of parameters + associated with the intent. + messages (Sequence[~.gcd_intent.Intent.Message]): + Optional. The collection of rich messages corresponding to + the ``Response`` field in the Dialogflow console. + default_response_platforms (Sequence[~.gcd_intent.Intent.Message.Platform]): + Optional. The list of platforms for which the first + responses will be copied from the messages in + PLATFORM_UNSPECIFIED (i.e. default platform). + root_followup_intent_name (str): + Read-only. The unique identifier of the root intent in the + chain of followup intents. It identifies the correct + followup intents chain for this intent. We populate this + field only in the output. + + Format: ``projects//agent/intents/``. + parent_followup_intent_name (str): + Read-only after creation. The unique identifier of the + parent intent in the chain of followup intents. You can set + this field when creating an intent, for example with + [CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent] + or + [BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents], + in order to make this intent a followup intent. + + It identifies the parent followup intent. Format: + ``projects//agent/intents/``. + followup_intent_info (Sequence[~.gcd_intent.Intent.FollowupIntentInfo]): + Read-only. Information about all followup + intents that have this intent as a direct or + indirect parent. We populate this field only in + the output. + """ + + class WebhookState(proto.Enum): + r"""Represents the different states that webhooks can be in.""" + WEBHOOK_STATE_UNSPECIFIED = 0 + WEBHOOK_STATE_ENABLED = 1 + WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2 + + class TrainingPhrase(proto.Message): + r"""Represents an example that the agent is trained on. + + Attributes: + name (str): + Output only. The unique identifier of this + training phrase. + type_ (~.gcd_intent.Intent.TrainingPhrase.Type): + Required. The type of the training phrase. + parts (Sequence[~.gcd_intent.Intent.TrainingPhrase.Part]): + Required. The ordered list of training phrase parts. The + parts are concatenated in order to form the training phrase. + + Note: The API does not automatically annotate training + phrases like the Dialogflow Console does. + + Note: Do not forget to include whitespace at part + boundaries, so the training phrase is well formatted when + the parts are concatenated. + + If the training phrase does not need to be annotated with + parameters, you just need a single part with only the + [Part.text][google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.text] + field set. + + If you want to annotate the training phrase, you must create + multiple parts, where the fields of each part are populated + in one of two ways: + + - ``Part.text`` is set to a part of the phrase that has no + parameters. + - ``Part.text`` is set to a part of the phrase that you + want to annotate, and the ``entity_type``, ``alias``, and + ``user_defined`` fields are all set. + times_added_count (int): + Optional. Indicates how many times this + example was added to the intent. Each time a + developer adds an existing sample by editing an + intent or training, this counter is increased. + """ + + class Type(proto.Enum): + r"""Represents different types of training phrases.""" + TYPE_UNSPECIFIED = 0 + EXAMPLE = 1 + TEMPLATE = 2 + + class Part(proto.Message): + r"""Represents a part of a training phrase. + + Attributes: + text (str): + Required. The text for this part. + entity_type (str): + Optional. The entity type name prefixed with ``@``. This + field is required for annotated parts of the training + phrase. + alias (str): + Optional. The parameter name for the value + extracted from the annotated part of the + example. This field is required for annotated + parts of the training phrase. + user_defined (bool): + Optional. Indicates whether the text was + manually annotated. This field is set to true + when the Dialogflow Console is used to manually + annotate the part. When creating an annotated + part with the API, you must set this to true. + """ + + text = proto.Field(proto.STRING, number=1) + + entity_type = proto.Field(proto.STRING, number=2) + + alias = proto.Field(proto.STRING, number=3) + + user_defined = proto.Field(proto.BOOL, number=4) + + name = proto.Field(proto.STRING, number=1) + + type_ = proto.Field(proto.ENUM, number=2, enum="Intent.TrainingPhrase.Type",) + + parts = proto.RepeatedField( + proto.MESSAGE, number=3, message="Intent.TrainingPhrase.Part", + ) + + times_added_count = proto.Field(proto.INT32, number=4) + + class Parameter(proto.Message): + r"""Represents intent parameters. + + Attributes: + name (str): + The unique identifier of this parameter. + display_name (str): + Required. The name of the parameter. + value (str): + Optional. The definition of the parameter value. It can be: + + - a constant string, + - a parameter value defined as ``$parameter_name``, + - an original parameter value defined as + ``$parameter_name.original``, + - a parameter value from some context defined as + ``#context_name.parameter_name``. + default_value (str): + Optional. The default value to use when the ``value`` yields + an empty result. Default values can be extracted from + contexts by using the following syntax: + ``#context_name.parameter_name``. + entity_type_display_name (str): + Optional. The name of the entity type, prefixed with ``@``, + that describes values of the parameter. If the parameter is + required, this must be provided. + mandatory (bool): + Optional. Indicates whether the parameter is + required. That is, whether the intent cannot be + completed without collecting the parameter + value. + prompts (Sequence[str]): + Optional. The collection of prompts that the + agent can present to the user in order to + collect a value for the parameter. + is_list (bool): + Optional. Indicates whether the parameter + represents a list of values. + """ + + name = proto.Field(proto.STRING, number=1) + + display_name = proto.Field(proto.STRING, number=2) + + value = proto.Field(proto.STRING, number=3) + + default_value = proto.Field(proto.STRING, number=4) + + entity_type_display_name = proto.Field(proto.STRING, number=5) + + mandatory = proto.Field(proto.BOOL, number=6) + + prompts = proto.RepeatedField(proto.STRING, number=7) + + is_list = proto.Field(proto.BOOL, number=8) + + class Message(proto.Message): + r"""A rich response message. Corresponds to the intent ``Response`` + field in the Dialogflow console. For more information, see `Rich + response + messages `__. + + Attributes: + text (~.gcd_intent.Intent.Message.Text): + The text response. + image (~.gcd_intent.Intent.Message.Image): + The image response. + quick_replies (~.gcd_intent.Intent.Message.QuickReplies): + The quick replies response. + card (~.gcd_intent.Intent.Message.Card): + The card response. + payload (~.struct.Struct): + A custom platform-specific response. + simple_responses (~.gcd_intent.Intent.Message.SimpleResponses): + The voice and text-only responses for Actions + on Google. + basic_card (~.gcd_intent.Intent.Message.BasicCard): + The basic card response for Actions on + Google. + suggestions (~.gcd_intent.Intent.Message.Suggestions): + The suggestion chips for Actions on Google. + link_out_suggestion (~.gcd_intent.Intent.Message.LinkOutSuggestion): + The link out suggestion chip for Actions on + Google. + list_select (~.gcd_intent.Intent.Message.ListSelect): + The list card response for Actions on Google. + carousel_select (~.gcd_intent.Intent.Message.CarouselSelect): + The carousel card response for Actions on + Google. + browse_carousel_card (~.gcd_intent.Intent.Message.BrowseCarouselCard): + Browse carousel card for Actions on Google. + table_card (~.gcd_intent.Intent.Message.TableCard): + Table card for Actions on Google. + media_content (~.gcd_intent.Intent.Message.MediaContent): + The media content card for Actions on Google. + platform (~.gcd_intent.Intent.Message.Platform): + Optional. The platform that this message is + intended for. + """ + + class Platform(proto.Enum): + r"""The rich response message integration platform. See + `Integrations `__. + """ + PLATFORM_UNSPECIFIED = 0 + FACEBOOK = 1 + SLACK = 2 + TELEGRAM = 3 + KIK = 4 + SKYPE = 5 + LINE = 6 + VIBER = 7 + ACTIONS_ON_GOOGLE = 8 + GOOGLE_HANGOUTS = 11 + + class Text(proto.Message): + r"""The text response message. + + Attributes: + text (Sequence[str]): + Optional. The collection of the agent's + responses. + """ + + text = proto.RepeatedField(proto.STRING, number=1) + + class Image(proto.Message): + r"""The image response message. + + Attributes: + image_uri (str): + Optional. The public URI to an image file. + accessibility_text (str): + Optional. A text description of the image to + be used for accessibility, e.g., screen readers. + """ + + image_uri = proto.Field(proto.STRING, number=1) + + accessibility_text = proto.Field(proto.STRING, number=2) + + class QuickReplies(proto.Message): + r"""The quick replies response message. + + Attributes: + title (str): + Optional. The title of the collection of + quick replies. + quick_replies (Sequence[str]): + Optional. The collection of quick replies. + """ + + title = proto.Field(proto.STRING, number=1) + + quick_replies = proto.RepeatedField(proto.STRING, number=2) + + class Card(proto.Message): + r"""The card response message. + + Attributes: + title (str): + Optional. The title of the card. + subtitle (str): + Optional. The subtitle of the card. + image_uri (str): + Optional. The public URI to an image file for + the card. + buttons (Sequence[~.gcd_intent.Intent.Message.Card.Button]): + Optional. The collection of card buttons. + """ + + class Button(proto.Message): + r"""Contains information about a button. + + Attributes: + text (str): + Optional. The text to show on the button. + postback (str): + Optional. The text to send back to the + Dialogflow API or a URI to open. + """ + + text = proto.Field(proto.STRING, number=1) + + postback = proto.Field(proto.STRING, number=2) + + title = proto.Field(proto.STRING, number=1) + + subtitle = proto.Field(proto.STRING, number=2) + + image_uri = proto.Field(proto.STRING, number=3) + + buttons = proto.RepeatedField( + proto.MESSAGE, number=4, message="Intent.Message.Card.Button", + ) + + class SimpleResponse(proto.Message): + r"""The simple response message containing speech or text. + + Attributes: + text_to_speech (str): + One of text_to_speech or ssml must be provided. The plain + text of the speech output. Mutually exclusive with ssml. + ssml (str): + One of text_to_speech or ssml must be provided. Structured + spoken response to the user in the SSML format. Mutually + exclusive with text_to_speech. + display_text (str): + Optional. The text to display. + """ + + text_to_speech = proto.Field(proto.STRING, number=1) + + ssml = proto.Field(proto.STRING, number=2) + + display_text = proto.Field(proto.STRING, number=3) + + class SimpleResponses(proto.Message): + r"""The collection of simple response candidates. This message in + ``QueryResult.fulfillment_messages`` and + ``WebhookResponse.fulfillment_messages`` should contain only one + ``SimpleResponse``. + + Attributes: + simple_responses (Sequence[~.gcd_intent.Intent.Message.SimpleResponse]): + Required. The list of simple responses. + """ + + simple_responses = proto.RepeatedField( + proto.MESSAGE, number=1, message="Intent.Message.SimpleResponse", + ) + + class BasicCard(proto.Message): + r"""The basic card message. Useful for displaying information. + + Attributes: + title (str): + Optional. The title of the card. + subtitle (str): + Optional. The subtitle of the card. + formatted_text (str): + Required, unless image is present. The body + text of the card. + image (~.gcd_intent.Intent.Message.Image): + Optional. The image for the card. + buttons (Sequence[~.gcd_intent.Intent.Message.BasicCard.Button]): + Optional. The collection of card buttons. + """ + + class Button(proto.Message): + r"""The button object that appears at the bottom of a card. + + Attributes: + title (str): + Required. The title of the button. + open_uri_action (~.gcd_intent.Intent.Message.BasicCard.Button.OpenUriAction): + Required. Action to take when a user taps on + the button. + """ + + class OpenUriAction(proto.Message): + r"""Opens the given URI. + + Attributes: + uri (str): + Required. The HTTP or HTTPS scheme URI. + """ + + uri = proto.Field(proto.STRING, number=1) + + title = proto.Field(proto.STRING, number=1) + + open_uri_action = proto.Field( + proto.MESSAGE, + number=2, + message="Intent.Message.BasicCard.Button.OpenUriAction", + ) + + title = proto.Field(proto.STRING, number=1) + + subtitle = proto.Field(proto.STRING, number=2) + + formatted_text = proto.Field(proto.STRING, number=3) + + image = proto.Field( + proto.MESSAGE, number=4, message="Intent.Message.Image", + ) + + buttons = proto.RepeatedField( + proto.MESSAGE, number=5, message="Intent.Message.BasicCard.Button", + ) + + class Suggestion(proto.Message): + r"""The suggestion chip message that the user can tap to quickly + post a reply to the conversation. + + Attributes: + title (str): + Required. The text shown the in the + suggestion chip. + """ + + title = proto.Field(proto.STRING, number=1) + + class Suggestions(proto.Message): + r"""The collection of suggestions. + + Attributes: + suggestions (Sequence[~.gcd_intent.Intent.Message.Suggestion]): + Required. The list of suggested replies. + """ + + suggestions = proto.RepeatedField( + proto.MESSAGE, number=1, message="Intent.Message.Suggestion", + ) + + class LinkOutSuggestion(proto.Message): + r"""The suggestion chip message that allows the user to jump out + to the app or website associated with this agent. + + Attributes: + destination_name (str): + Required. The name of the app or site this + chip is linking to. + uri (str): + Required. The URI of the app or site to open + when the user taps the suggestion chip. + """ + + destination_name = proto.Field(proto.STRING, number=1) + + uri = proto.Field(proto.STRING, number=2) + + class ListSelect(proto.Message): + r"""The card for presenting a list of options to select from. + + Attributes: + title (str): + Optional. The overall title of the list. + items (Sequence[~.gcd_intent.Intent.Message.ListSelect.Item]): + Required. List items. + subtitle (str): + Optional. Subtitle of the list. + """ + + class Item(proto.Message): + r"""An item in the list. + + Attributes: + info (~.gcd_intent.Intent.Message.SelectItemInfo): + Required. Additional information about this + option. + title (str): + Required. The title of the list item. + description (str): + Optional. The main text describing the item. + image (~.gcd_intent.Intent.Message.Image): + Optional. The image to display. + """ + + info = proto.Field( + proto.MESSAGE, number=1, message="Intent.Message.SelectItemInfo", + ) + + title = proto.Field(proto.STRING, number=2) + + description = proto.Field(proto.STRING, number=3) + + image = proto.Field( + proto.MESSAGE, number=4, message="Intent.Message.Image", + ) + + title = proto.Field(proto.STRING, number=1) + + items = proto.RepeatedField( + proto.MESSAGE, number=2, message="Intent.Message.ListSelect.Item", + ) + + subtitle = proto.Field(proto.STRING, number=3) + + class CarouselSelect(proto.Message): + r"""The card for presenting a carousel of options to select from. + + Attributes: + items (Sequence[~.gcd_intent.Intent.Message.CarouselSelect.Item]): + Required. Carousel items. + """ + + class Item(proto.Message): + r"""An item in the carousel. + + Attributes: + info (~.gcd_intent.Intent.Message.SelectItemInfo): + Required. Additional info about the option + item. + title (str): + Required. Title of the carousel item. + description (str): + Optional. The body text of the card. + image (~.gcd_intent.Intent.Message.Image): + Optional. The image to display. + """ + + info = proto.Field( + proto.MESSAGE, number=1, message="Intent.Message.SelectItemInfo", + ) + + title = proto.Field(proto.STRING, number=2) + + description = proto.Field(proto.STRING, number=3) + + image = proto.Field( + proto.MESSAGE, number=4, message="Intent.Message.Image", + ) + + items = proto.RepeatedField( + proto.MESSAGE, number=1, message="Intent.Message.CarouselSelect.Item", + ) + + class SelectItemInfo(proto.Message): + r"""Additional info about the select item for when it is + triggered in a dialog. + + Attributes: + key (str): + Required. A unique key that will be sent back + to the agent if this response is given. + synonyms (Sequence[str]): + Optional. A list of synonyms that can also be + used to trigger this item in dialog. + """ + + key = proto.Field(proto.STRING, number=1) + + synonyms = proto.RepeatedField(proto.STRING, number=2) + + class MediaContent(proto.Message): + r"""The media content card for Actions on Google. + + Attributes: + media_type (~.gcd_intent.Intent.Message.MediaContent.ResponseMediaType): + Optional. What type of media is the content + (ie "audio"). + media_objects (Sequence[~.gcd_intent.Intent.Message.MediaContent.ResponseMediaObject]): + Required. List of media objects. + """ + + class ResponseMediaType(proto.Enum): + r"""Format of response media type.""" + RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0 + AUDIO = 1 + + class ResponseMediaObject(proto.Message): + r"""Response media object for media content card. + + Attributes: + name (str): + Required. Name of media card. + description (str): + Optional. Description of media card. + large_image (~.gcd_intent.Intent.Message.Image): + Optional. Image to display above media + content. + icon (~.gcd_intent.Intent.Message.Image): + Optional. Icon to display above media + content. + content_url (str): + Required. Url where the media is stored. + """ + + name = proto.Field(proto.STRING, number=1) + + description = proto.Field(proto.STRING, number=2) + + large_image = proto.Field( + proto.MESSAGE, + number=3, + oneof="image", + message="Intent.Message.Image", + ) + + icon = proto.Field( + proto.MESSAGE, + number=4, + oneof="image", + message="Intent.Message.Image", + ) + + content_url = proto.Field(proto.STRING, number=5) + + media_type = proto.Field( + proto.ENUM, + number=1, + enum="Intent.Message.MediaContent.ResponseMediaType", + ) + + media_objects = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Intent.Message.MediaContent.ResponseMediaObject", + ) + + class BrowseCarouselCard(proto.Message): + r"""Browse Carousel Card for Actions on Google. + https://developers.google.com/actions/assistant/responses#browsing_carousel + + Attributes: + items (Sequence[~.gcd_intent.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem]): + Required. List of items in the Browse + Carousel Card. Minimum of two items, maximum of + ten. + image_display_options (~.gcd_intent.Intent.Message.BrowseCarouselCard.ImageDisplayOptions): + Optional. Settings for displaying the image. Applies to + every image in + [items][google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.items]. + """ + + class ImageDisplayOptions(proto.Enum): + r"""Image display options for Actions on Google. This should be + used for when the image's aspect ratio does not match the image + container's aspect ratio. + """ + IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0 + GRAY = 1 + WHITE = 2 + CROPPED = 3 + BLURRED_BACKGROUND = 4 + + class BrowseCarouselCardItem(proto.Message): + r"""Browsing carousel tile + + Attributes: + open_uri_action (~.gcd_intent.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction): + Required. Action to present to the user. + title (str): + Required. Title of the carousel item. Maximum + of two lines of text. + description (str): + Optional. Description of the carousel item. + Maximum of four lines of text. + image (~.gcd_intent.Intent.Message.Image): + Optional. Hero image for the carousel item. + footer (str): + Optional. Text that appears at the bottom of + the Browse Carousel Card. Maximum of one line of + text. + """ + + class OpenUrlAction(proto.Message): + r"""Actions on Google action to open a given url. + + Attributes: + url (str): + Required. URL + url_type_hint (~.gcd_intent.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint): + Optional. Specifies the type of viewer that + is used when opening the URL. Defaults to + opening via web browser. + """ + + class UrlTypeHint(proto.Enum): + r"""Type of the URI.""" + URL_TYPE_HINT_UNSPECIFIED = 0 + AMP_ACTION = 1 + AMP_CONTENT = 2 + + url = proto.Field(proto.STRING, number=1) + + url_type_hint = proto.Field( + proto.ENUM, + number=3, + enum="Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint", + ) + + open_uri_action = proto.Field( + proto.MESSAGE, + number=1, + message="Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction", + ) + + title = proto.Field(proto.STRING, number=2) + + description = proto.Field(proto.STRING, number=3) + + image = proto.Field( + proto.MESSAGE, number=4, message="Intent.Message.Image", + ) + + footer = proto.Field(proto.STRING, number=5) + + items = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem", + ) + + image_display_options = proto.Field( + proto.ENUM, + number=2, + enum="Intent.Message.BrowseCarouselCard.ImageDisplayOptions", + ) + + class TableCard(proto.Message): + r"""Table card for Actions on Google. + + Attributes: + title (str): + Required. Title of the card. + subtitle (str): + Optional. Subtitle to the title. + image (~.gcd_intent.Intent.Message.Image): + Optional. Image which should be displayed on + the card. + column_properties (Sequence[~.gcd_intent.Intent.Message.ColumnProperties]): + Optional. Display properties for the columns + in this table. + rows (Sequence[~.gcd_intent.Intent.Message.TableCardRow]): + Optional. Rows in this table of data. + buttons (Sequence[~.gcd_intent.Intent.Message.BasicCard.Button]): + Optional. List of buttons for the card. + """ + + title = proto.Field(proto.STRING, number=1) + + subtitle = proto.Field(proto.STRING, number=2) + + image = proto.Field( + proto.MESSAGE, number=3, message="Intent.Message.Image", + ) + + column_properties = proto.RepeatedField( + proto.MESSAGE, number=4, message="Intent.Message.ColumnProperties", + ) + + rows = proto.RepeatedField( + proto.MESSAGE, number=5, message="Intent.Message.TableCardRow", + ) + + buttons = proto.RepeatedField( + proto.MESSAGE, number=6, message="Intent.Message.BasicCard.Button", + ) + + class ColumnProperties(proto.Message): + r"""Column properties for + [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard]. + + Attributes: + header (str): + Required. Column heading. + horizontal_alignment (~.gcd_intent.Intent.Message.ColumnProperties.HorizontalAlignment): + Optional. Defines text alignment for all + cells in this column. + """ + + class HorizontalAlignment(proto.Enum): + r"""Text alignments within a cell.""" + HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0 + LEADING = 1 + CENTER = 2 + TRAILING = 3 + + header = proto.Field(proto.STRING, number=1) + + horizontal_alignment = proto.Field( + proto.ENUM, + number=2, + enum="Intent.Message.ColumnProperties.HorizontalAlignment", + ) + + class TableCardRow(proto.Message): + r"""Row of + [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard]. + + Attributes: + cells (Sequence[~.gcd_intent.Intent.Message.TableCardCell]): + Optional. List of cells that make up this + row. + divider_after (bool): + Optional. Whether to add a visual divider + after this row. + """ + + cells = proto.RepeatedField( + proto.MESSAGE, number=1, message="Intent.Message.TableCardCell", + ) + + divider_after = proto.Field(proto.BOOL, number=2) + + class TableCardCell(proto.Message): + r"""Cell of + [TableCardRow][google.cloud.dialogflow.v2.Intent.Message.TableCardRow]. + + Attributes: + text (str): + Required. Text in this cell. + """ + + text = proto.Field(proto.STRING, number=1) + + text = proto.Field( + proto.MESSAGE, number=1, oneof="message", message="Intent.Message.Text", + ) + + image = proto.Field( + proto.MESSAGE, number=2, oneof="message", message="Intent.Message.Image", + ) + + quick_replies = proto.Field( + proto.MESSAGE, + number=3, + oneof="message", + message="Intent.Message.QuickReplies", + ) + + card = proto.Field( + proto.MESSAGE, number=4, oneof="message", message="Intent.Message.Card", + ) + + payload = proto.Field( + proto.MESSAGE, number=5, oneof="message", message=struct.Struct, + ) + + simple_responses = proto.Field( + proto.MESSAGE, + number=7, + oneof="message", + message="Intent.Message.SimpleResponses", + ) + + basic_card = proto.Field( + proto.MESSAGE, + number=8, + oneof="message", + message="Intent.Message.BasicCard", + ) + + suggestions = proto.Field( + proto.MESSAGE, + number=9, + oneof="message", + message="Intent.Message.Suggestions", + ) + + link_out_suggestion = proto.Field( + proto.MESSAGE, + number=10, + oneof="message", + message="Intent.Message.LinkOutSuggestion", + ) + + list_select = proto.Field( + proto.MESSAGE, + number=11, + oneof="message", + message="Intent.Message.ListSelect", + ) + + carousel_select = proto.Field( + proto.MESSAGE, + number=12, + oneof="message", + message="Intent.Message.CarouselSelect", + ) + + browse_carousel_card = proto.Field( + proto.MESSAGE, + number=22, + oneof="message", + message="Intent.Message.BrowseCarouselCard", + ) + + table_card = proto.Field( + proto.MESSAGE, + number=23, + oneof="message", + message="Intent.Message.TableCard", + ) + + media_content = proto.Field( + proto.MESSAGE, + number=24, + oneof="message", + message="Intent.Message.MediaContent", + ) + + platform = proto.Field(proto.ENUM, number=6, enum="Intent.Message.Platform",) + + class FollowupIntentInfo(proto.Message): + r"""Represents a single followup intent in the chain. + + Attributes: + followup_intent_name (str): + The unique identifier of the followup intent. Format: + ``projects//agent/intents/``. + parent_followup_intent_name (str): + The unique identifier of the followup intent's parent. + Format: ``projects//agent/intents/``. + """ + + followup_intent_name = proto.Field(proto.STRING, number=1) + + parent_followup_intent_name = proto.Field(proto.STRING, number=2) + + name = proto.Field(proto.STRING, number=1) + + display_name = proto.Field(proto.STRING, number=2) + + webhook_state = proto.Field(proto.ENUM, number=6, enum=WebhookState,) + + priority = proto.Field(proto.INT32, number=3) + + is_fallback = proto.Field(proto.BOOL, number=4) + + ml_disabled = proto.Field(proto.BOOL, number=19) + + input_context_names = proto.RepeatedField(proto.STRING, number=7) + + events = proto.RepeatedField(proto.STRING, number=8) + + training_phrases = proto.RepeatedField( + proto.MESSAGE, number=9, message=TrainingPhrase, + ) + + action = proto.Field(proto.STRING, number=10) + + output_contexts = proto.RepeatedField( + proto.MESSAGE, number=11, message=context.Context, + ) + + reset_contexts = proto.Field(proto.BOOL, number=12) + + parameters = proto.RepeatedField(proto.MESSAGE, number=13, message=Parameter,) + + messages = proto.RepeatedField(proto.MESSAGE, number=14, message=Message,) + + default_response_platforms = proto.RepeatedField( + proto.ENUM, number=15, enum=Message.Platform, + ) + + root_followup_intent_name = proto.Field(proto.STRING, number=16) + + parent_followup_intent_name = proto.Field(proto.STRING, number=17) + + followup_intent_info = proto.RepeatedField( + proto.MESSAGE, number=18, message=FollowupIntentInfo, + ) + + +class ListIntentsRequest(proto.Message): + r"""The request message for + [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. + + Attributes: + parent (str): + Required. The agent to list all intents from. Format: + ``projects//agent``. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + intent_view (~.gcd_intent.IntentView): + Optional. The resource view to apply to the + returned intent. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list request. + """ + + parent = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=2) + + intent_view = proto.Field(proto.ENUM, number=3, enum="IntentView",) + + page_size = proto.Field(proto.INT32, number=4) + + page_token = proto.Field(proto.STRING, number=5) + + +class ListIntentsResponse(proto.Message): + r"""The response message for + [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. + + Attributes: + intents (Sequence[~.gcd_intent.Intent]): + The list of agent intents. There will be a maximum number of + items returned based on the page_size field in the request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + intents = proto.RepeatedField(proto.MESSAGE, number=1, message="Intent",) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class GetIntentRequest(proto.Message): + r"""The request message for + [Intents.GetIntent][google.cloud.dialogflow.v2.Intents.GetIntent]. + + Attributes: + name (str): + Required. The name of the intent. Format: + ``projects//agent/intents/``. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + intent_view (~.gcd_intent.IntentView): + Optional. The resource view to apply to the + returned intent. + """ + + name = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=2) + + intent_view = proto.Field(proto.ENUM, number=3, enum="IntentView",) + + +class CreateIntentRequest(proto.Message): + r"""The request message for + [Intents.CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent]. + + Attributes: + parent (str): + Required. The agent to create a intent for. Format: + ``projects//agent``. + intent (~.gcd_intent.Intent): + Required. The intent to create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + intent_view (~.gcd_intent.IntentView): + Optional. The resource view to apply to the + returned intent. + """ + + parent = proto.Field(proto.STRING, number=1) + + intent = proto.Field(proto.MESSAGE, number=2, message="Intent",) + + language_code = proto.Field(proto.STRING, number=3) + + intent_view = proto.Field(proto.ENUM, number=4, enum="IntentView",) + + +class UpdateIntentRequest(proto.Message): + r"""The request message for + [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent]. + + Attributes: + intent (~.gcd_intent.Intent): + Required. The intent to update. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + intent_view (~.gcd_intent.IntentView): + Optional. The resource view to apply to the + returned intent. + """ + + 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.FieldMask,) + + intent_view = proto.Field(proto.ENUM, number=4, enum="IntentView",) + + +class DeleteIntentRequest(proto.Message): + r"""The request message for + [Intents.DeleteIntent][google.cloud.dialogflow.v2.Intents.DeleteIntent]. + + Attributes: + name (str): + Required. The name of the intent to delete. If this intent + has direct or indirect followup intents, we also delete + them. Format: + ``projects//agent/intents/``. + """ + + name = proto.Field(proto.STRING, number=1) + + +class BatchUpdateIntentsRequest(proto.Message): + r""" + + Attributes: + parent (str): + Required. The name of the agent to update or create intents + in. Format: ``projects//agent``. + intent_batch_uri (str): + The URI to a Google Cloud Storage file + containing intents to update or create. The file + format can either be a serialized proto (of + IntentBatch type) or JSON object. Note: The URI + must start with "gs://". + intent_batch_inline (~.gcd_intent.IntentBatch): + The collection of intents to update or + create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + intent_view (~.gcd_intent.IntentView): + Optional. The resource view to apply to the + returned intent. + """ + + parent = proto.Field(proto.STRING, number=1) + + intent_batch_uri = proto.Field(proto.STRING, number=2, oneof="intent_batch") + + intent_batch_inline = proto.Field( + proto.MESSAGE, number=3, oneof="intent_batch", message="IntentBatch", + ) + + language_code = proto.Field(proto.STRING, number=4) + + update_mask = proto.Field(proto.MESSAGE, number=5, message=field_mask.FieldMask,) + + intent_view = proto.Field(proto.ENUM, number=6, enum="IntentView",) + + +class BatchUpdateIntentsResponse(proto.Message): + r"""The response message for + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents]. + + Attributes: + intents (Sequence[~.gcd_intent.Intent]): + The collection of updated or created intents. + """ + + intents = proto.RepeatedField(proto.MESSAGE, number=1, message="Intent",) + + +class BatchDeleteIntentsRequest(proto.Message): + r"""The request message for + [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2.Intents.BatchDeleteIntents]. + + Attributes: + parent (str): + Required. The name of the agent to delete all entities types + for. Format: ``projects//agent``. + intents (Sequence[~.gcd_intent.Intent]): + Required. The collection of intents to delete. Only intent + ``name`` must be filled in. + """ + + parent = proto.Field(proto.STRING, number=1) + + intents = proto.RepeatedField(proto.MESSAGE, number=2, message="Intent",) + + +class IntentBatch(proto.Message): + r"""This message is a wrapper around a collection of intents. + + Attributes: + intents (Sequence[~.gcd_intent.Intent]): + A collection of intents. + """ + + intents = proto.RepeatedField(proto.MESSAGE, number=1, message="Intent",) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2/types/session.py b/google/cloud/dialogflow_v2/types/session.py new file mode 100644 index 000000000..ee2a9be77 --- /dev/null +++ b/google/cloud/dialogflow_v2/types/session.py @@ -0,0 +1,818 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.cloud.dialogflow_v2.types import audio_config as gcd_audio_config +from google.cloud.dialogflow_v2.types import context +from google.cloud.dialogflow_v2.types import intent as gcd_intent +from google.cloud.dialogflow_v2.types import session_entity_type +from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore +from google.rpc import status_pb2 as status # type: ignore +from google.type import latlng_pb2 as latlng # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2", + manifest={ + "DetectIntentRequest", + "DetectIntentResponse", + "QueryParameters", + "QueryInput", + "QueryResult", + "StreamingDetectIntentRequest", + "StreamingDetectIntentResponse", + "StreamingRecognitionResult", + "TextInput", + "EventInput", + "SentimentAnalysisRequestConfig", + "SentimentAnalysisResult", + "Sentiment", + }, +) + + +class DetectIntentRequest(proto.Message): + r"""The request to detect user's intent. + + Attributes: + session (str): + Required. The name of the session this query is sent to. + Format: + ``projects//agent/sessions/``, or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we are + using "-". It's up to the API caller to choose an + appropriate ``Session ID`` and ``User Id``. They can be a + random number or some type of user and session identifiers + (preferably hashed). The length of the ``Session ID`` and + ``User ID`` must not exceed 36 characters. + + For more information, see the `API interactions + guide `__. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + query_params (~.gcd_session.QueryParameters): + The parameters of this query. + query_input (~.gcd_session.QueryInput): + Required. The input specification. It can be + set to: + 1. an audio config + which instructs the speech recognizer how to + process the speech audio, + 2. a conversational query in the form of text, + or + 3. an event that specifies which intent to + trigger. + output_audio_config (~.gcd_audio_config.OutputAudioConfig): + Instructs the speech synthesizer how to + generate the output audio. If this field is not + set and agent-level speech synthesizer is not + configured, no output audio is generated. + output_audio_config_mask (~.field_mask.FieldMask): + Mask for + [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] + indicating which settings in this request-level config + should override speech synthesizer settings defined at + agent-level. + + If unspecified or empty, + [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] + replaces the agent-level config in its entirety. + input_audio (bytes): + The natural language speech audio to be processed. This + field should be populated iff ``query_input`` is set to an + input audio config. A single request can contain up to 1 + minute of speech audio data. + """ + + 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=gcd_audio_config.OutputAudioConfig, + ) + + output_audio_config_mask = proto.Field( + proto.MESSAGE, number=7, message=field_mask.FieldMask, + ) + + input_audio = proto.Field(proto.BYTES, number=5) + + +class DetectIntentResponse(proto.Message): + r"""The message returned from the DetectIntent method. + + Attributes: + response_id (str): + The unique identifier of the response. It can + be used to locate a response in the training + example set or for reporting issues. + query_result (~.gcd_session.QueryResult): + The selected results of the conversational query or event + processing. See ``alternative_query_results`` for additional + potential results. + webhook_status (~.status.Status): + Specifies the status of the webhook request. + output_audio (bytes): + The audio data bytes encoded as specified in the request. + Note: The output audio is generated based on the values of + default platform text responses found in the + ``query_result.fulfillment_messages`` field. If multiple + default text responses exist, they will be concatenated when + generating audio. If no default platform text responses + exist, the generated audio content will be empty. + + In some scenarios, multiple output audio fields may be + present in the response structure. In these cases, only the + top-most-level audio output has content. + output_audio_config (~.gcd_audio_config.OutputAudioConfig): + The config used by the speech synthesizer to + generate the output audio. + """ + + response_id = proto.Field(proto.STRING, number=1) + + query_result = proto.Field(proto.MESSAGE, number=2, message="QueryResult",) + + webhook_status = proto.Field(proto.MESSAGE, number=3, message=status.Status,) + + output_audio = proto.Field(proto.BYTES, number=4) + + output_audio_config = proto.Field( + proto.MESSAGE, number=6, message=gcd_audio_config.OutputAudioConfig, + ) + + +class QueryParameters(proto.Message): + r"""Represents the parameters of the conversational query. + + Attributes: + time_zone (str): + The time zone of this conversational query from the `time + zone database `__, e.g., + America/New_York, Europe/Paris. If not provided, the time + zone specified in agent settings is used. + geo_location (~.latlng.LatLng): + The geo location of this conversational + query. + contexts (Sequence[~.context.Context]): + The collection of contexts to be activated + before this query is executed. + reset_contexts (bool): + Specifies whether to delete all contexts in + the current session before the new ones are + activated. + session_entity_types (Sequence[~.session_entity_type.SessionEntityType]): + Additional session entity types to replace or + extend developer entity types with. The entity + synonyms apply to all languages and persist for + the session of this query. + payload (~.struct.Struct): + This field can be used to pass custom data to your webhook. + Arbitrary JSON objects are supported. If supplied, the value + is used to populate the + ``WebhookRequest.original_detect_intent_request.payload`` + field sent to your webhook. + sentiment_analysis_request_config (~.gcd_session.SentimentAnalysisRequestConfig): + Configures the type of sentiment analysis to + perform. If not provided, sentiment analysis is + not performed. + webhook_headers (Sequence[~.gcd_session.QueryParameters.WebhookHeadersEntry]): + 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 + configured through the Dialogflow web console. + The headers defined within this field will + overwrite the headers configured through the + Dialogflow console if there is a conflict. + Header names are case-insensitive. Google's + specified headers are not allowed. Including: + "Host", "Content-Length", "Connection", "From", + "User-Agent", "Accept-Encoding", "If-Modified- + Since", "If-None-Match", "X-Forwarded-For", etc. + """ + + time_zone = proto.Field(proto.STRING, number=1) + + geo_location = proto.Field(proto.MESSAGE, number=2, message=latlng.LatLng,) + + contexts = proto.RepeatedField(proto.MESSAGE, number=3, message=context.Context,) + + reset_contexts = proto.Field(proto.BOOL, number=4) + + session_entity_types = proto.RepeatedField( + proto.MESSAGE, number=5, message=session_entity_type.SessionEntityType, + ) + + payload = proto.Field(proto.MESSAGE, number=6, message=struct.Struct,) + + sentiment_analysis_request_config = proto.Field( + proto.MESSAGE, number=10, message="SentimentAnalysisRequestConfig", + ) + + webhook_headers = proto.MapField(proto.STRING, proto.STRING, number=14) + + +class QueryInput(proto.Message): + r"""Represents the query input. It can contain either: + 1. An audio config which + instructs the speech recognizer how to process the speech + audio. + 2. A conversational query in the form of text,. + + 3. An event that specifies which intent to trigger. + + Attributes: + audio_config (~.gcd_audio_config.InputAudioConfig): + Instructs the speech recognizer how to + process the speech audio. + text (~.gcd_session.TextInput): + The natural language text to be processed. + event (~.gcd_session.EventInput): + The event to be processed. + """ + + audio_config = proto.Field( + proto.MESSAGE, + number=1, + oneof="input", + message=gcd_audio_config.InputAudioConfig, + ) + + text = proto.Field(proto.MESSAGE, number=2, oneof="input", message="TextInput",) + + event = proto.Field(proto.MESSAGE, number=3, oneof="input", message="EventInput",) + + +class QueryResult(proto.Message): + r"""Represents the result of conversational query or event + processing. + + Attributes: + query_text (str): + The original conversational query text: + + - If natural language text was provided as input, + ``query_text`` contains a copy of the input. + - If natural language speech audio was provided as input, + ``query_text`` contains the speech recognition result. If + speech recognizer produced multiple alternatives, a + particular one is picked. + - If automatic spell correction is enabled, ``query_text`` + will contain the corrected user input. + language_code (str): + The language that was triggered during intent detection. See + `Language + Support `__ + for a list of the currently supported language codes. + speech_recognition_confidence (float): + The Speech recognition confidence between 0.0 + and 1.0. A higher number indicates an estimated + greater likelihood that the recognized words are + correct. The default of 0.0 is a sentinel value + indicating that confidence was not set. + + This field is not guaranteed to be accurate or + set. In particular this field isn't set for + StreamingDetectIntent since the streaming + endpoint has separate confidence estimates per + portion of the audio in + StreamingRecognitionResult. + action (str): + The action name from the matched intent. + parameters (~.struct.Struct): + The collection of extracted parameters. + 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: string or + number, depending on parameter value type - + MapValue value: + - If parameter's entity type is a + composite entity: map from composite + entity property names to property values - + Else: parameter value + all_required_params_present (bool): + This field is set to: + + - ``false`` if the matched intent has required parameters + and not all of the required parameter values have been + collected. + - ``true`` if all required parameter values have been + collected, or if the matched intent doesn't contain any + required parameters. + fulfillment_text (str): + The text to be pronounced to the user or shown on the + screen. Note: This is a legacy field, + ``fulfillment_messages`` should be preferred. + fulfillment_messages (Sequence[~.gcd_intent.Intent.Message]): + The collection of rich messages to present to + the user. + webhook_source (str): + If the query was fulfilled by a webhook call, this field is + set to the value of the ``source`` field returned in the + webhook response. + webhook_payload (~.struct.Struct): + If the query was fulfilled by a webhook call, this field is + set to the value of the ``payload`` field returned in the + webhook response. + output_contexts (Sequence[~.context.Context]): + The collection of output contexts. If applicable, + ``output_contexts.parameters`` contains entries with name + ``.original`` containing the original + parameter values before the query. + intent (~.gcd_intent.Intent): + The intent that matched the conversational query. Some, not + all fields are filled in this message, including but not + limited to: ``name``, ``display_name``, ``end_interaction`` + and ``is_fallback``. + intent_detection_confidence (float): + The intent detection confidence. Values range from 0.0 + (completely uncertain) to 1.0 (completely certain). This + value is for informational purpose only and is only used to + help match the best intent within the classification + threshold. This value may change for the same end-user + expression at any time due to a model retraining or change + in implementation. If there are + ``multiple knowledge_answers`` messages, this value is set + to the greatest ``knowledgeAnswers.match_confidence`` value + in the list. + diagnostic_info (~.struct.Struct): + Free-form diagnostic information for the + associated detect intent request. The fields of + this data can change without notice, so you + should not write code that depends on its + structure. + The data may contain: + + - webhook call latency + - webhook errors + sentiment_analysis_result (~.gcd_session.SentimentAnalysisResult): + The sentiment analysis result, which depends on the + ``sentiment_analysis_request_config`` specified in the + request. + """ + + query_text = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=15) + + speech_recognition_confidence = proto.Field(proto.FLOAT, number=2) + + action = proto.Field(proto.STRING, number=3) + + parameters = proto.Field(proto.MESSAGE, number=4, message=struct.Struct,) + + all_required_params_present = proto.Field(proto.BOOL, number=5) + + fulfillment_text = proto.Field(proto.STRING, number=6) + + fulfillment_messages = proto.RepeatedField( + proto.MESSAGE, number=7, message=gcd_intent.Intent.Message, + ) + + webhook_source = proto.Field(proto.STRING, number=8) + + webhook_payload = proto.Field(proto.MESSAGE, number=9, message=struct.Struct,) + + output_contexts = proto.RepeatedField( + proto.MESSAGE, number=10, message=context.Context, + ) + + intent = proto.Field(proto.MESSAGE, number=11, message=gcd_intent.Intent,) + + intent_detection_confidence = proto.Field(proto.FLOAT, number=12) + + diagnostic_info = proto.Field(proto.MESSAGE, number=14, message=struct.Struct,) + + sentiment_analysis_result = proto.Field( + proto.MESSAGE, number=17, message="SentimentAnalysisResult", + ) + + +class StreamingDetectIntentRequest(proto.Message): + r"""The top-level message sent by the client to the + [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent] + method. + + Multiple request messages should be sent in order: + + 1. The first message must contain + [session][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session], + [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] + plus optionally + [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. + If the client wants to receive an audio response, it should also + contain + [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]. + The message must not contain + [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]. + + 2. If + [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] + was set to + [query_input.audio_config][google.cloud.dialogflow.v2.InputAudioConfig], + all subsequent messages must contain + [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio] + to continue with Speech recognition. If you decide to rather + detect an intent from text input after you already started Speech + recognition, please send a message with + [query_input.text][google.cloud.dialogflow.v2.QueryInput.text]. + + However, note that: + + - Dialogflow will bill you for the audio duration so far. + - Dialogflow discards all Speech recognition results in favor of + the input text. + - Dialogflow will use the language code from the first message. + + After you sent all input, you must half-close or abort the request + stream. + + Attributes: + session (str): + Required. The name of the session the query is sent to. + Format of the session name: + ``projects//agent/sessions/``, or + ``projects//agent/environments//users//sessions/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we are + using "-". It's up to the API caller to choose an + appropriate ``Session ID`` and ``User Id``. They can be a + random number or some type of user and session identifiers + (preferably hashed). The length of the ``Session ID`` and + ``User ID`` must not exceed 36 characters. + + For more information, see the `API interactions + guide `__. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + query_params (~.gcd_session.QueryParameters): + The parameters of this query. + query_input (~.gcd_session.QueryInput): + Required. The input specification. It can be + set to: + 1. an audio config which instructs the speech + recognizer how to process the speech audio, + + 2. a conversational query in the form of text, + or + 3. an event that specifies which intent to + trigger. + single_utterance (bool): + Please use + [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2.InputAudioConfig.single_utterance] + instead. If ``false`` (default), recognition does not cease + until the client closes the stream. If ``true``, the + recognizer will detect a single spoken utterance in input + audio. Recognition ceases when it detects the audio's voice + has stopped or paused. In this case, once a detected intent + is received, the client should close the stream and start a + new request with a new stream as needed. This setting is + ignored when ``query_input`` is a piece of text or an event. + output_audio_config (~.gcd_audio_config.OutputAudioConfig): + Instructs the speech synthesizer how to + generate the output audio. If this field is not + set and agent-level speech synthesizer is not + configured, no output audio is generated. + output_audio_config_mask (~.field_mask.FieldMask): + Mask for + [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] + indicating which settings in this request-level config + should override speech synthesizer settings defined at + agent-level. + + If unspecified or empty, + [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] + replaces the agent-level config in its entirety. + input_audio (bytes): + The input audio content to be recognized. Must be sent if + ``query_input`` was set to a streaming input audio config. + The complete audio over all streaming messages must not + exceed 1 minute. + """ + + 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",) + + single_utterance = proto.Field(proto.BOOL, number=4) + + output_audio_config = proto.Field( + proto.MESSAGE, number=5, message=gcd_audio_config.OutputAudioConfig, + ) + + output_audio_config_mask = proto.Field( + proto.MESSAGE, number=7, message=field_mask.FieldMask, + ) + + input_audio = proto.Field(proto.BYTES, number=6) + + +class StreamingDetectIntentResponse(proto.Message): + r"""The top-level message returned from the ``StreamingDetectIntent`` + method. + + Multiple response messages can be returned in order: + + 1. If the input was set to streaming audio, the first one or more + messages contain ``recognition_result``. Each + ``recognition_result`` represents a more complete transcript of + what the user said. The last ``recognition_result`` has + ``is_final`` set to ``true``. + + 2. The next message contains ``response_id``, ``query_result`` and + optionally ``webhook_status`` if a WebHook was called. + + Attributes: + response_id (str): + The unique identifier of the response. It can + be used to locate a response in the training + example set or for reporting issues. + recognition_result (~.gcd_session.StreamingRecognitionResult): + The result of speech recognition. + query_result (~.gcd_session.QueryResult): + The result of the conversational query or + event processing. + webhook_status (~.status.Status): + Specifies the status of the webhook request. + output_audio (bytes): + The audio data bytes encoded as specified in the request. + Note: The output audio is generated based on the values of + default platform text responses found in the + ``query_result.fulfillment_messages`` field. If multiple + default text responses exist, they will be concatenated when + generating audio. If no default platform text responses + exist, the generated audio content will be empty. + + In some scenarios, multiple output audio fields may be + present in the response structure. In these cases, only the + top-most-level audio output has content. + output_audio_config (~.gcd_audio_config.OutputAudioConfig): + The config used by the speech synthesizer to + generate the output audio. + """ + + response_id = proto.Field(proto.STRING, number=1) + + recognition_result = proto.Field( + proto.MESSAGE, number=2, message="StreamingRecognitionResult", + ) + + query_result = proto.Field(proto.MESSAGE, number=3, message="QueryResult",) + + webhook_status = proto.Field(proto.MESSAGE, number=4, message=status.Status,) + + output_audio = proto.Field(proto.BYTES, number=5) + + output_audio_config = proto.Field( + proto.MESSAGE, number=6, message=gcd_audio_config.OutputAudioConfig, + ) + + +class StreamingRecognitionResult(proto.Message): + r"""Contains a speech recognition result corresponding to a portion of + the audio that is currently being processed or an indication that + this is the end of the single requested utterance. + + Example: + + 1. transcript: "tube" + + 2. transcript: "to be a" + + 3. transcript: "to be" + + 4. transcript: "to be or not to be" is_final: true + + 5. transcript: " that's" + + 6. transcript: " that is" + + 7. message_type: ``END_OF_SINGLE_UTTERANCE`` + + 8. transcript: " that is the question" is_final: true + + Only two of the responses contain final results (#4 and #8 indicated + by ``is_final: true``). Concatenating these generates the full + transcript: "to be or not to be that is the question". + + In each response we populate: + + - for ``TRANSCRIPT``: ``transcript`` and possibly ``is_final``. + + - for ``END_OF_SINGLE_UTTERANCE``: only ``message_type``. + + Attributes: + message_type (~.gcd_session.StreamingRecognitionResult.MessageType): + Type of the result message. + transcript (str): + Transcript text representing the words that the user spoke. + Populated if and only if ``message_type`` = ``TRANSCRIPT``. + is_final (bool): + If ``false``, the ``StreamingRecognitionResult`` represents + an interim result that may change. If ``true``, the + recognizer will not return any further hypotheses about this + piece of the audio. May only be populated for + ``message_type`` = ``TRANSCRIPT``. + confidence (float): + The Speech confidence between 0.0 and 1.0 for the current + portion of audio. A higher number indicates an estimated + greater likelihood that the recognized words are correct. + The default of 0.0 is a sentinel value indicating that + confidence was not set. + + This field is typically only provided if ``is_final`` is + true and you should not rely on it being accurate or even + set. + speech_word_info (Sequence[~.gcd_audio_config.SpeechWordInfo]): + Word-specific information for the words recognized by Speech + in + [transcript][google.cloud.dialogflow.v2.StreamingRecognitionResult.transcript]. + Populated if and only if ``message_type`` = ``TRANSCRIPT`` + and [InputAudioConfig.enable_word_info] is set. + speech_end_offset (~.duration.Duration): + Time offset of the end of this Speech recognition result + relative to the beginning of the audio. Only populated for + ``message_type`` = ``TRANSCRIPT``. + """ + + class MessageType(proto.Enum): + r"""Type of the response message.""" + MESSAGE_TYPE_UNSPECIFIED = 0 + 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) + + speech_word_info = proto.RepeatedField( + proto.MESSAGE, number=7, message=gcd_audio_config.SpeechWordInfo, + ) + + speech_end_offset = proto.Field(proto.MESSAGE, number=8, message=duration.Duration,) + + +class TextInput(proto.Message): + r"""Represents the natural language text to be processed. + + Attributes: + text (str): + Required. The UTF-8 encoded natural language + text to be processed. Text length must not + exceed 256 characters. + language_code (str): + Required. The language of this conversational query. See + `Language + Support `__ + for a list of the currently supported language codes. Note + that queries in the same session do not necessarily need to + specify the same language. + """ + + text = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=2) + + +class EventInput(proto.Message): + r"""Events allow for matching intents by event name instead of the + natural language input. For instance, input + ```` + can trigger a personalized welcome response. The parameter ``name`` + may be used by the agent in the response: + ``"Hello #welcome_event.name! What can I do for you today?"``. + + Attributes: + name (str): + Required. The unique identifier of the event. + parameters (~.struct.Struct): + The collection of parameters associated with + the event. + 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: string or + number, depending on parameter value type - + MapValue value: + - If parameter's entity type is a + composite entity: map from composite + entity property names to property values - + Else: parameter value + language_code (str): + Required. The language of this query. See `Language + Support `__ + for a list of the currently supported language codes. Note + that queries in the same session do not necessarily need to + specify the same language. + """ + + name = proto.Field(proto.STRING, number=1) + + parameters = proto.Field(proto.MESSAGE, number=2, message=struct.Struct,) + + language_code = proto.Field(proto.STRING, number=3) + + +class SentimentAnalysisRequestConfig(proto.Message): + r"""Configures the types of sentiment analysis to perform. + + Attributes: + analyze_query_text_sentiment (bool): + Instructs the service to perform sentiment analysis on + ``query_text``. If not provided, sentiment analysis is not + performed on ``query_text``. + """ + + analyze_query_text_sentiment = proto.Field(proto.BOOL, number=1) + + +class SentimentAnalysisResult(proto.Message): + r"""The result of sentiment analysis. Sentiment analysis inspects user + input and identifies the prevailing subjective opinion, especially + to determine a user's attitude as positive, negative, or neutral. + For [Participants.DetectIntent][], it needs to be configured in + [DetectIntentRequest.query_params][google.cloud.dialogflow.v2.DetectIntentRequest.query_params]. + For [Participants.StreamingDetectIntent][], it needs to be + configured in + [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. + And for + [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] + and + [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent], + it needs to be configured in + [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2.ConversationProfile.human_agent_assistant_config] + + Attributes: + query_text_sentiment (~.gcd_session.Sentiment): + The sentiment analysis result for ``query_text``. + """ + + query_text_sentiment = proto.Field(proto.MESSAGE, number=1, message="Sentiment",) + + +class Sentiment(proto.Message): + r"""The sentiment, such as positive/negative feeling or + association, for a unit of analysis, such as the query text. + + Attributes: + score (float): + Sentiment score between -1.0 (negative + sentiment) and 1.0 (positive sentiment). + magnitude (float): + A non-negative number in the [0, +inf) range, which + represents the absolute magnitude of sentiment, regardless + of score (positive or negative). + """ + + score = proto.Field(proto.FLOAT, number=1) + + magnitude = proto.Field(proto.FLOAT, number=2) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2/types/session_entity_type.py b/google/cloud/dialogflow_v2/types/session_entity_type.py new file mode 100644 index 000000000..37ad8d790 --- /dev/null +++ b/google/cloud/dialogflow_v2/types/session_entity_type.py @@ -0,0 +1,222 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.cloud.dialogflow_v2.types import entity_type +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2", + manifest={ + "SessionEntityType", + "ListSessionEntityTypesRequest", + "ListSessionEntityTypesResponse", + "GetSessionEntityTypeRequest", + "CreateSessionEntityTypeRequest", + "UpdateSessionEntityTypeRequest", + "DeleteSessionEntityTypeRequest", + }, +) + + +class SessionEntityType(proto.Message): + r"""A session represents a conversation between a Dialogflow agent and + an end-user. You can create special entities, called session + entities, during a session. Session entities can extend or replace + custom entity types and only exist during the session that they were + created for. All session data, including session entities, is stored + by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + Attributes: + name (str): + Required. The unique identifier of this session entity type. + Format: + ``projects//agent/sessions//entityTypes/``, + or + ``projects//agent/environments//users//sessions//entityTypes/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + + ```` must be the display name of + an existing entity type in the same agent that will be + overridden or supplemented. + entity_override_mode (~.gcd_session_entity_type.SessionEntityType.EntityOverrideMode): + Required. Indicates whether the additional + data should override or supplement the custom + entity type definition. + entities (Sequence[~.entity_type.EntityType.Entity]): + Required. The collection of entities + associated with this session entity type. + """ + + class EntityOverrideMode(proto.Enum): + r"""The types of modifications for a session entity type.""" + ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0 + 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=2, enum=EntityOverrideMode,) + + entities = proto.RepeatedField( + proto.MESSAGE, number=3, message=entity_type.EntityType.Entity, + ) + + +class ListSessionEntityTypesRequest(proto.Message): + r"""The request message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. + + Attributes: + parent (str): + Required. The session to list all session entity types from. + Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users// sessions/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list request. + """ + + 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): + r"""The response message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. + + Attributes: + session_entity_types (Sequence[~.gcd_session_entity_type.SessionEntityType]): + The list of session entity types. There will be a maximum + number of items returned based on the page_size field in the + request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + session_entity_types = proto.RepeatedField( + proto.MESSAGE, number=1, message="SessionEntityType", + ) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class GetSessionEntityTypeRequest(proto.Message): + r"""The request message for + [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType]. + + Attributes: + name (str): + Required. The name of the session entity type. Format: + ``projects//agent/sessions//entityTypes/`` + or + ``projects//agent/environments//users//sessions//entityTypes/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + """ + + name = proto.Field(proto.STRING, number=1) + + +class CreateSessionEntityTypeRequest(proto.Message): + r"""The request message for + [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType]. + + Attributes: + parent (str): + Required. The session to create a session entity type for. + Format: + ``projects//agent/sessions/`` or + ``projects//agent/environments//users// sessions/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + session_entity_type (~.gcd_session_entity_type.SessionEntityType): + Required. The session entity type to create. + """ + + parent = proto.Field(proto.STRING, number=1) + + session_entity_type = proto.Field( + proto.MESSAGE, number=2, message="SessionEntityType", + ) + + +class UpdateSessionEntityTypeRequest(proto.Message): + r"""The request message for + [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType]. + + Attributes: + session_entity_type (~.gcd_session_entity_type.SessionEntityType): + Required. The session entity type to update. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + """ + + session_entity_type = proto.Field( + proto.MESSAGE, number=1, message="SessionEntityType", + ) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteSessionEntityTypeRequest(proto.Message): + r"""The request message for + [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType]. + + Attributes: + name (str): + Required. The name of the entity type to delete. Format: + ``projects//agent/sessions//entityTypes/`` + or + ``projects//agent/environments//users//sessions//entityTypes/``. + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + """ + + name = proto.Field(proto.STRING, number=1) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2/types/validation_result.py b/google/cloud/dialogflow_v2/types/validation_result.py new file mode 100644 index 000000000..2681cf8de --- /dev/null +++ b/google/cloud/dialogflow_v2/types/validation_result.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2", + manifest={"ValidationError", "ValidationResult",}, +) + + +class ValidationError(proto.Message): + r"""Represents a single validation error. + + Attributes: + severity (~.validation_result.ValidationError.Severity): + The severity of the error. + entries (Sequence[str]): + The names of the entries that the error is + associated with. Format: + + - "projects//agent", if the error is + associated with the entire agent. + - "projects//agent/intents/", if the error is associated with certain + intents. + - "projects//agent/intents//trainingPhrases/", if + the error is associated with certain intent + training phrases. - "projects//agent/intents//parameters/", if the error is + associated with certain intent parameters. - + "projects//agent/entities/", if the error is associated with certain + entities. + error_message (str): + The detailed error messsage. + """ + + class Severity(proto.Enum): + r"""Represents a level of severity.""" + SEVERITY_UNSPECIFIED = 0 + INFO = 1 + WARNING = 2 + ERROR = 3 + CRITICAL = 4 + + severity = proto.Field(proto.ENUM, number=1, enum=Severity,) + + entries = proto.RepeatedField(proto.STRING, number=3) + + error_message = proto.Field(proto.STRING, number=4) + + +class ValidationResult(proto.Message): + r"""Represents the output of agent validation. + + Attributes: + validation_errors (Sequence[~.validation_result.ValidationError]): + Contains all validation errors. + """ + + validation_errors = proto.RepeatedField( + proto.MESSAGE, number=1, message="ValidationError", + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2/types/webhook.py b/google/cloud/dialogflow_v2/types/webhook.py new file mode 100644 index 000000000..df744273f --- /dev/null +++ b/google/cloud/dialogflow_v2/types/webhook.py @@ -0,0 +1,203 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.cloud.dialogflow_v2.types import context +from google.cloud.dialogflow_v2.types import intent +from google.cloud.dialogflow_v2.types import session as gcd_session +from google.cloud.dialogflow_v2.types import session_entity_type +from google.protobuf import struct_pb2 as struct # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2", + manifest={"WebhookRequest", "WebhookResponse", "OriginalDetectIntentRequest",}, +) + + +class WebhookRequest(proto.Message): + r"""The request message for a webhook call. + + Attributes: + session (str): + The unique identifier of detectIntent request session. Can + be used to identify end-user inside webhook implementation. + Format: + ``projects//agent/sessions/``, or + ``projects//agent/environments//users//sessions/``. + response_id (str): + The unique identifier of the response. Contains the same + value as ``[Streaming]DetectIntentResponse.response_id``. + query_result (~.gcd_session.QueryResult): + The result of the conversational query or event processing. + Contains the same value as + ``[Streaming]DetectIntentResponse.query_result``. + original_detect_intent_request (~.webhook.OriginalDetectIntentRequest): + Optional. The contents of the original request that was + passed to ``[Streaming]DetectIntent`` call. + """ + + session = proto.Field(proto.STRING, number=4) + + response_id = proto.Field(proto.STRING, number=1) + + query_result = proto.Field( + proto.MESSAGE, number=2, message=gcd_session.QueryResult, + ) + + original_detect_intent_request = proto.Field( + proto.MESSAGE, number=3, message="OriginalDetectIntentRequest", + ) + + +class WebhookResponse(proto.Message): + r"""The response message for a webhook call. + + This response is validated by the Dialogflow server. If validation + fails, an error will be returned in the + [QueryResult.diagnostic_info][google.cloud.dialogflow.v2.QueryResult.diagnostic_info] + field. Setting JSON fields to an empty value with the wrong type is + a common error. To avoid this error: + + - Use ``""`` for empty strings + - Use ``{}`` or ``null`` for empty objects + - Use ``[]`` or ``null`` for empty arrays + + For more information, see the `Protocol Buffers Language + Guide `__. + + Attributes: + fulfillment_text (str): + Optional. The text response message intended for the + end-user. It is recommended to use + ``fulfillment_messages.text.text[0]`` instead. When + provided, Dialogflow uses this field to populate + [QueryResult.fulfillment_text][google.cloud.dialogflow.v2.QueryResult.fulfillment_text] + sent to the integration or API caller. + fulfillment_messages (Sequence[~.intent.Intent.Message]): + Optional. The rich response messages intended for the + end-user. When provided, Dialogflow uses this field to + populate + [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2.QueryResult.fulfillment_messages] + sent to the integration or API caller. + source (str): + Optional. A custom field used to identify the webhook + source. Arbitrary strings are supported. When provided, + Dialogflow uses this field to populate + [QueryResult.webhook_source][google.cloud.dialogflow.v2.QueryResult.webhook_source] + sent to the integration or API caller. + payload (~.struct.Struct): + Optional. This field can be used to pass custom data from + your webhook to the integration or API caller. Arbitrary + JSON objects are supported. When provided, Dialogflow uses + this field to populate + [QueryResult.webhook_payload][google.cloud.dialogflow.v2.QueryResult.webhook_payload] + sent to the integration or API caller. This field is also + used by the `Google Assistant + integration `__ + for rich response messages. See the format definition at + `Google Assistant Dialogflow webhook + format `__ + output_contexts (Sequence[~.context.Context]): + Optional. The collection of output contexts that will + overwrite currently active contexts for the session and + reset their lifespans. When provided, Dialogflow uses this + field to populate + [QueryResult.output_contexts][google.cloud.dialogflow.v2.QueryResult.output_contexts] + sent to the integration or API caller. + followup_event_input (~.gcd_session.EventInput): + Optional. Invokes the supplied events. When this field is + set, Dialogflow ignores the ``fulfillment_text``, + ``fulfillment_messages``, and ``payload`` fields. + session_entity_types (Sequence[~.session_entity_type.SessionEntityType]): + Optional. Additional session entity types to replace or + extend developer entity types with. The entity synonyms + apply to all languages and persist for the session. Setting + this data from a webhook overwrites the session entity types + that have been set using ``detectIntent``, + ``streamingDetectIntent`` or + [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType] + management methods. + """ + + fulfillment_text = proto.Field(proto.STRING, number=1) + + fulfillment_messages = proto.RepeatedField( + proto.MESSAGE, number=2, message=intent.Intent.Message, + ) + + source = proto.Field(proto.STRING, number=3) + + payload = proto.Field(proto.MESSAGE, number=4, message=struct.Struct,) + + output_contexts = proto.RepeatedField( + proto.MESSAGE, number=5, message=context.Context, + ) + + followup_event_input = proto.Field( + proto.MESSAGE, number=6, message=gcd_session.EventInput, + ) + + session_entity_types = proto.RepeatedField( + proto.MESSAGE, number=10, message=session_entity_type.SessionEntityType, + ) + + +class OriginalDetectIntentRequest(proto.Message): + r"""Represents the contents of the original request that was passed to + the ``[Streaming]DetectIntent`` call. + + Attributes: + source (str): + The source of this request, e.g., ``google``, ``facebook``, + ``slack``. It is set by Dialogflow-owned servers. + version (str): + Optional. The version of the protocol used + for this request. This field is AoG-specific. + payload (~.struct.Struct): + Optional. This field is set to the value of the + ``QueryParameters.payload`` field passed in the request. + Some integrations that query a Dialogflow agent may provide + additional information in the payload. + + In particular, for the Dialogflow Phone Gateway integration, + this field has the form: + + .. raw:: html + +
{
+                 "telephony": {
+                   "caller_id": "+18558363987"
+                 }
+                }
+ + Note: The caller ID field (``caller_id``) will be redacted + for Trial Edition agents and populated with the caller ID in + `E.164 format `__ for + Essentials Edition agents. + """ + + source = proto.Field(proto.STRING, number=1) + + version = proto.Field(proto.STRING, number=2) + + payload = proto.Field(proto.MESSAGE, number=3, message=struct.Struct,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/__init__.py b/google/cloud/dialogflow_v2beta1/__init__.py new file mode 100644 index 000000000..626c16596 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/__init__.py @@ -0,0 +1,249 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .services.agents import AgentsClient +from .services.contexts import ContextsClient +from .services.documents import DocumentsClient +from .services.entity_types import EntityTypesClient +from .services.environments import EnvironmentsClient +from .services.intents import IntentsClient +from .services.knowledge_bases import KnowledgeBasesClient +from .services.session_entity_types import SessionEntityTypesClient +from .services.sessions import SessionsClient +from .types.agent import Agent +from .types.agent import DeleteAgentRequest +from .types.agent import ExportAgentRequest +from .types.agent import ExportAgentResponse +from .types.agent import GetAgentRequest +from .types.agent import GetValidationResultRequest +from .types.agent import ImportAgentRequest +from .types.agent import RestoreAgentRequest +from .types.agent import SearchAgentsRequest +from .types.agent import SearchAgentsResponse +from .types.agent import SetAgentRequest +from .types.agent import SubAgent +from .types.agent import TrainAgentRequest +from .types.audio_config import AudioEncoding +from .types.audio_config import InputAudioConfig +from .types.audio_config import OutputAudioConfig +from .types.audio_config import OutputAudioEncoding +from .types.audio_config import SpeechContext +from .types.audio_config import SpeechModelVariant +from .types.audio_config import SpeechWordInfo +from .types.audio_config import SsmlVoiceGender +from .types.audio_config import SynthesizeSpeechConfig +from .types.audio_config import TelephonyDtmf +from .types.audio_config import TelephonyDtmfEvents +from .types.audio_config import VoiceSelectionParams +from .types.context import Context +from .types.context import CreateContextRequest +from .types.context import DeleteAllContextsRequest +from .types.context import DeleteContextRequest +from .types.context import GetContextRequest +from .types.context import ListContextsRequest +from .types.context import ListContextsResponse +from .types.context import UpdateContextRequest +from .types.document import CreateDocumentRequest +from .types.document import DeleteDocumentRequest +from .types.document import Document +from .types.document import GetDocumentRequest +from .types.document import KnowledgeOperationMetadata +from .types.document import ListDocumentsRequest +from .types.document import ListDocumentsResponse +from .types.document import ReloadDocumentRequest +from .types.document import UpdateDocumentRequest +from .types.entity_type import BatchCreateEntitiesRequest +from .types.entity_type import BatchDeleteEntitiesRequest +from .types.entity_type import BatchDeleteEntityTypesRequest +from .types.entity_type import BatchUpdateEntitiesRequest +from .types.entity_type import BatchUpdateEntityTypesRequest +from .types.entity_type import BatchUpdateEntityTypesResponse +from .types.entity_type import CreateEntityTypeRequest +from .types.entity_type import DeleteEntityTypeRequest +from .types.entity_type import EntityType +from .types.entity_type import EntityTypeBatch +from .types.entity_type import GetEntityTypeRequest +from .types.entity_type import ListEntityTypesRequest +from .types.entity_type import ListEntityTypesResponse +from .types.entity_type import UpdateEntityTypeRequest +from .types.environment import Environment +from .types.environment import ListEnvironmentsRequest +from .types.environment import ListEnvironmentsResponse +from .types.gcs import GcsSource +from .types.intent import BatchDeleteIntentsRequest +from .types.intent import BatchUpdateIntentsRequest +from .types.intent import BatchUpdateIntentsResponse +from .types.intent import CreateIntentRequest +from .types.intent import DeleteIntentRequest +from .types.intent import GetIntentRequest +from .types.intent import Intent +from .types.intent import IntentBatch +from .types.intent import IntentView +from .types.intent import ListIntentsRequest +from .types.intent import ListIntentsResponse +from .types.intent import UpdateIntentRequest +from .types.knowledge_base import CreateKnowledgeBaseRequest +from .types.knowledge_base import DeleteKnowledgeBaseRequest +from .types.knowledge_base import GetKnowledgeBaseRequest +from .types.knowledge_base import KnowledgeBase +from .types.knowledge_base import ListKnowledgeBasesRequest +from .types.knowledge_base import ListKnowledgeBasesResponse +from .types.knowledge_base import UpdateKnowledgeBaseRequest +from .types.session import DetectIntentRequest +from .types.session import DetectIntentResponse +from .types.session import EventInput +from .types.session import KnowledgeAnswers +from .types.session import QueryInput +from .types.session import QueryParameters +from .types.session import QueryResult +from .types.session import Sentiment +from .types.session import SentimentAnalysisRequestConfig +from .types.session import SentimentAnalysisResult +from .types.session import StreamingDetectIntentRequest +from .types.session import StreamingDetectIntentResponse +from .types.session import StreamingRecognitionResult +from .types.session import TextInput +from .types.session_entity_type import CreateSessionEntityTypeRequest +from .types.session_entity_type import DeleteSessionEntityTypeRequest +from .types.session_entity_type import GetSessionEntityTypeRequest +from .types.session_entity_type import ListSessionEntityTypesRequest +from .types.session_entity_type import ListSessionEntityTypesResponse +from .types.session_entity_type import SessionEntityType +from .types.session_entity_type import UpdateSessionEntityTypeRequest +from .types.validation_result import ValidationError +from .types.validation_result import ValidationResult +from .types.webhook import OriginalDetectIntentRequest +from .types.webhook import WebhookRequest +from .types.webhook import WebhookResponse + + +__all__ = ( + "Agent", + "AgentsClient", + "AudioEncoding", + "BatchCreateEntitiesRequest", + "BatchDeleteEntitiesRequest", + "BatchDeleteEntityTypesRequest", + "BatchDeleteIntentsRequest", + "BatchUpdateEntitiesRequest", + "BatchUpdateEntityTypesRequest", + "BatchUpdateEntityTypesResponse", + "BatchUpdateIntentsRequest", + "BatchUpdateIntentsResponse", + "Context", + "ContextsClient", + "CreateContextRequest", + "CreateDocumentRequest", + "CreateEntityTypeRequest", + "CreateIntentRequest", + "CreateKnowledgeBaseRequest", + "CreateSessionEntityTypeRequest", + "DeleteAgentRequest", + "DeleteAllContextsRequest", + "DeleteContextRequest", + "DeleteDocumentRequest", + "DeleteEntityTypeRequest", + "DeleteIntentRequest", + "DeleteKnowledgeBaseRequest", + "DeleteSessionEntityTypeRequest", + "DetectIntentRequest", + "DetectIntentResponse", + "Document", + "DocumentsClient", + "EntityType", + "EntityTypeBatch", + "EntityTypesClient", + "Environment", + "EnvironmentsClient", + "EventInput", + "ExportAgentRequest", + "ExportAgentResponse", + "GcsSource", + "GetAgentRequest", + "GetContextRequest", + "GetDocumentRequest", + "GetEntityTypeRequest", + "GetIntentRequest", + "GetKnowledgeBaseRequest", + "GetSessionEntityTypeRequest", + "GetValidationResultRequest", + "ImportAgentRequest", + "InputAudioConfig", + "Intent", + "IntentBatch", + "IntentView", + "IntentsClient", + "KnowledgeAnswers", + "KnowledgeBase", + "KnowledgeBasesClient", + "KnowledgeOperationMetadata", + "ListContextsRequest", + "ListContextsResponse", + "ListDocumentsRequest", + "ListDocumentsResponse", + "ListEntityTypesRequest", + "ListEntityTypesResponse", + "ListEnvironmentsRequest", + "ListEnvironmentsResponse", + "ListIntentsRequest", + "ListIntentsResponse", + "ListKnowledgeBasesRequest", + "ListKnowledgeBasesResponse", + "ListSessionEntityTypesRequest", + "ListSessionEntityTypesResponse", + "OriginalDetectIntentRequest", + "OutputAudioConfig", + "OutputAudioEncoding", + "QueryInput", + "QueryParameters", + "QueryResult", + "ReloadDocumentRequest", + "RestoreAgentRequest", + "SearchAgentsRequest", + "SearchAgentsResponse", + "Sentiment", + "SentimentAnalysisRequestConfig", + "SentimentAnalysisResult", + "SessionEntityType", + "SessionEntityTypesClient", + "SetAgentRequest", + "SpeechContext", + "SpeechModelVariant", + "SpeechWordInfo", + "SsmlVoiceGender", + "StreamingDetectIntentRequest", + "StreamingDetectIntentResponse", + "StreamingRecognitionResult", + "SubAgent", + "SynthesizeSpeechConfig", + "TelephonyDtmf", + "TelephonyDtmfEvents", + "TextInput", + "TrainAgentRequest", + "UpdateContextRequest", + "UpdateDocumentRequest", + "UpdateEntityTypeRequest", + "UpdateIntentRequest", + "UpdateKnowledgeBaseRequest", + "UpdateSessionEntityTypeRequest", + "ValidationError", + "ValidationResult", + "VoiceSelectionParams", + "WebhookRequest", + "WebhookResponse", + "SessionsClient", +) diff --git a/dialogflow_v2beta1/proto/agent.proto b/google/cloud/dialogflow_v2beta1/proto/agent.proto similarity index 92% rename from dialogflow_v2beta1/proto/agent.proto rename to google/cloud/dialogflow_v2beta1/proto/agent.proto index dec8dde09..bb413e845 100644 --- a/dialogflow_v2beta1/proto/agent.proto +++ b/google/cloud/dialogflow_v2beta1/proto/agent.proto @@ -194,6 +194,9 @@ service Agents { rpc GetValidationResult(GetValidationResultRequest) returns (ValidationResult) { option (google.api.http) = { get: "/v2beta1/{parent=projects/*}/agent/validationResult" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/agent/validationResult" + } }; } } @@ -259,8 +262,14 @@ message Agent { } // Required. The project of this agent. - // Format: `projects/`. - string parent = 1; + // Format: `projects/` or + // `projects//locations/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; // Required. The name of this agent. string display_name = 2; @@ -296,7 +305,7 @@ message Agent { bool enable_logging = 8; // Optional. Determines how intents are detected from user queries. - MatchMode match_mode = 9; + MatchMode match_mode = 9 [deprecated = true]; // Optional. To filter out false positive results and still get variety in // matched natural language inputs for your agent, you can tune the machine @@ -320,7 +329,8 @@ message Agent { // The request message for [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent]. message GetAgentRequest { // Required. The project that the agent to fetch is associated with. - // Format: `projects/`. + // Format: `projects/` or + // `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -341,7 +351,8 @@ message SetAgentRequest { // The request message for [Agents.DeleteAgent][google.cloud.dialogflow.v2beta1.Agents.DeleteAgent]. message DeleteAgentRequest { // Required. The project that the agent to delete is associated with. - // Format: `projects/`. + // Format: `projects/` or + // `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -353,7 +364,8 @@ message DeleteAgentRequest { // Contains basic configuration for a sub-agent. message SubAgent { // Required. The project of this agent. - // Format: `projects/`. + // Format: `projects/` or + // `projects//locations/`. string project = 1; // Optional. The unique identifier (`environment name` in dialogflow console) @@ -365,7 +377,8 @@ message SubAgent { // The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. message SearchAgentsRequest { // Required. The project to list agents from. - // Format: `projects/`. + // Format: `projects/` or + // `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -395,7 +408,8 @@ message SearchAgentsResponse { // The request message for [Agents.TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent]. message TrainAgentRequest { // Required. The project that the agent to train is associated with. - // Format: `projects/`. + // Format: `projects/` or + // `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -407,7 +421,8 @@ message TrainAgentRequest { // The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. message ExportAgentRequest { // Required. The project that the agent to export is associated with. - // Format: `projects/`. + // Format: `projects/` or + // `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -439,7 +454,8 @@ message ExportAgentResponse { // The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent]. message ImportAgentRequest { // Required. The project that the agent to import is associated with. - // Format: `projects/`. + // Format: `projects/` or + // `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -461,7 +477,8 @@ message ImportAgentRequest { // The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2beta1.Agents.RestoreAgent]. message RestoreAgentRequest { // Required. The project that the agent to restore is associated with. - // Format: `projects/`. + // Format: `projects/` or + // `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -483,7 +500,8 @@ message RestoreAgentRequest { // The request message for [Agents.GetValidationResult][google.cloud.dialogflow.v2beta1.Agents.GetValidationResult]. message GetValidationResultRequest { // Required. The project that the agent is associated with. - // Format: `projects/`. + // Format: `projects/` or + // `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/dialogflow_v2beta1/proto/audio_config.proto b/google/cloud/dialogflow_v2beta1/proto/audio_config.proto similarity index 93% rename from dialogflow_v2beta1/proto/audio_config.proto rename to google/cloud/dialogflow_v2beta1/proto/audio_config.proto index 0d3c3acf4..7afa9bbc6 100644 --- a/dialogflow_v2beta1/proto/audio_config.proto +++ b/google/cloud/dialogflow_v2beta1/proto/audio_config.proto @@ -30,36 +30,6 @@ option java_outer_classname = "AudioConfigProto"; option java_package = "com.google.cloud.dialogflow.v2beta1"; option objc_class_prefix = "DF"; -// Hints for the speech recognizer to help with recognition in a specific -// conversation state. -message SpeechContext { - // Optional. A list of strings containing words and phrases that the speech - // recognizer should recognize with higher likelihood. - // - // This list can be used to: - // - // * improve accuracy for words and phrases you expect the user to say, - // e.g. typical commands for your Dialogflow agent - // * add additional words to the speech recognizer vocabulary - // * ... - // - // See the [Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/quotas) for usage - // limits. - repeated string phrases = 1; - - // Optional. Boost for this context compared to other contexts: - // - // * If the boost is positive, Dialogflow will increase the probability that - // the phrases in this context are recognized over similar sounding phrases. - // * If the boost is unspecified or non-positive, Dialogflow will not apply - // any boost. - // - // Dialogflow recommends that you use boosts in the range (0, 20] and that you - // find a value that fits your use case with binary search. - float boost = 2; -} - // Audio encoding of the audio content sent in the conversational query request. // Refer to the // [Cloud Speech API @@ -109,6 +79,36 @@ enum AudioEncoding { AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; } +// Hints for the speech recognizer to help with recognition in a specific +// conversation state. +message SpeechContext { + // Optional. A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // This list can be used to: + // + // * improve accuracy for words and phrases you expect the user to say, + // e.g. typical commands for your Dialogflow agent + // * add additional words to the speech recognizer vocabulary + // * ... + // + // See the [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/quotas) for usage + // limits. + repeated string phrases = 1; + + // Optional. Boost for this context compared to other contexts: + // + // * If the boost is positive, Dialogflow will increase the probability that + // the phrases in this context are recognized over similar sounding phrases. + // * If the boost is unspecified or non-positive, Dialogflow will not apply + // any boost. + // + // Dialogflow recommends that you use boosts in the range (0, 20] and that you + // find a value that fits your use case with binary search. + float boost = 2; +} + // Information for a word recognized by the speech recognizer. message SpeechWordInfo { // The word this info is for. @@ -350,3 +350,64 @@ enum OutputAudioEncoding { // than MP3 while using approximately the same bitrate. OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; } + +// A wrapper of repeated TelephonyDtmf digits. +message TelephonyDtmfEvents { + // A sequence of TelephonyDtmf digits. + repeated TelephonyDtmf dtmf_events = 1; +} + +// [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling) +// digit in Telephony Gateway. +enum TelephonyDtmf { + // Not specified. This value may be used to indicate an absent digit. + TELEPHONY_DTMF_UNSPECIFIED = 0; + + // Number: '1'. + DTMF_ONE = 1; + + // Number: '2'. + DTMF_TWO = 2; + + // Number: '3'. + DTMF_THREE = 3; + + // Number: '4'. + DTMF_FOUR = 4; + + // Number: '5'. + DTMF_FIVE = 5; + + // Number: '6'. + DTMF_SIX = 6; + + // Number: '7'. + DTMF_SEVEN = 7; + + // Number: '8'. + DTMF_EIGHT = 8; + + // Number: '9'. + DTMF_NINE = 9; + + // Number: '0'. + DTMF_ZERO = 10; + + // Letter: 'A'. + DTMF_A = 11; + + // Letter: 'B'. + DTMF_B = 12; + + // Letter: 'C'. + DTMF_C = 13; + + // Letter: 'D'. + DTMF_D = 14; + + // Asterisk/star: '*'. + DTMF_STAR = 15; + + // Pound/diamond/hash/square/gate/octothorpe: '#'. + DTMF_POUND = 16; +} diff --git a/dialogflow_v2beta1/proto/context.proto b/google/cloud/dialogflow_v2beta1/proto/context.proto similarity index 73% rename from dialogflow_v2beta1/proto/context.proto rename to google/cloud/dialogflow_v2beta1/proto/context.proto index e829882d9..949552057 100644 --- a/dialogflow_v2beta1/proto/context.proto +++ b/google/cloud/dialogflow_v2beta1/proto/context.proto @@ -176,10 +176,16 @@ message Context { pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}" }; - // Required. The unique identifier of the context. Format: - // `projects//agent/sessions//contexts/`, - // or `projects//agent/environments//users//sessions//contexts/`. + // Required. The unique identifier of the context. Supported formats: + // - `projects//agent/sessions//contexts/`, + // - `projects//locations//agent/sessions//contexts/`, + // - `projects//agent/environments//users//sessions//contexts/`, + // - `projects//locations//agent/environments//users//sessions//contexts/`, // // The `Context ID` is always converted to lowercase, may only contain // characters in a-zA-Z0-9_-% and may be at most 250 bytes long. @@ -221,12 +227,19 @@ message Context { // The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. message ListContextsRequest { - // Required. The session to list all contexts from. - // Format: `projects//agent/sessions/` or - // `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - // default 'draft' environment. If `User ID` is not specified, we assume - // default '-' user. + // Required. The session to list all contexts from. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -255,12 +268,20 @@ message ListContextsResponse { // The request message for [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext]. message GetContextRequest { - // Required. The name of the context. Format: - // `projects//agent/sessions//contexts/` - // or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - // not specified, we assume default 'draft' environment. If `User ID` is not - // specified, we assume default '-' user. + // Required. The name of the context. Supported formats: + // - `projects//agent/sessions//contexts/`, + // - `projects//locations//agent/sessions//contexts/`, + // - `projects//agent/environments//users//sessions//contexts/`, + // - `projects//locations//agent/environments//users//sessions//contexts/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -271,12 +292,19 @@ message GetContextRequest { // The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext]. message CreateContextRequest { - // Required. The session to create a context for. - // Format: `projects//agent/sessions/` or - // `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - // default 'draft' environment. If `User ID` is not specified, we assume - // default '-' user. + // Required. The session to create a context for. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -299,12 +327,20 @@ message UpdateContextRequest { // The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext]. message DeleteContextRequest { - // Required. The name of the context to delete. Format: - // `projects//agent/sessions//contexts/` - // or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - // not specified, we assume default 'draft' environment. If `User ID` is not - // specified, we assume default '-' user. + // Required. The name of the context to delete. Supported formats: + // - `projects//agent/sessions//contexts/`, + // - `projects//locations//agent/sessions//contexts/`, + // - `projects//agent/environments//users//sessions//contexts/`, + // - `projects//locations//agent/environments//users//sessions//contexts/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -315,11 +351,19 @@ message DeleteContextRequest { // The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts]. message DeleteAllContextsRequest { - // Required. The name of the session to delete all contexts from. Format: - // `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. + // Required. The name of the session to delete all contexts from. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified we assume default 'draft' environment. If + // `User ID` is not specified, we assume default '-' user. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/dialogflow_v2beta1/proto/document.proto b/google/cloud/dialogflow_v2beta1/proto/document.proto similarity index 81% rename from dialogflow_v2beta1/proto/document.proto rename to google/cloud/dialogflow_v2beta1/proto/document.proto index d3facb741..a0bc4812a 100644 --- a/dialogflow_v2beta1/proto/document.proto +++ b/google/cloud/dialogflow_v2beta1/proto/document.proto @@ -49,6 +49,9 @@ service Documents { rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { option (google.api.http) = { get: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + } additional_bindings { get: "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" } @@ -63,6 +66,9 @@ service Documents { rpc GetDocument(GetDocumentRequest) returns (Document) { option (google.api.http) = { get: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + } additional_bindings { get: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" } @@ -78,6 +84,10 @@ service Documents { option (google.api.http) = { post: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents" body: "document" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + body: "document" + } additional_bindings { post: "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" body: "document" @@ -97,6 +107,9 @@ service Documents { rpc DeleteDocument(DeleteDocumentRequest) returns (google.longrunning.Operation) { option (google.api.http) = { delete: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + } additional_bindings { delete: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" } @@ -116,6 +129,10 @@ service Documents { option (google.api.http) = { patch: "/v2beta1/{document.name=projects/*/knowledgeBases/*/documents/*}" body: "document" + additional_bindings { + patch: "/v2beta1/{document.name=projects/*/locations/*/knowledgeBases/*/documents/*}" + body: "document" + } additional_bindings { patch: "/v2beta1/{document.name=projects/*/agent/knowledgeBases/*/documents/*}" body: "document" @@ -133,6 +150,9 @@ service Documents { // content. The previously loaded content of the document will be deleted. // Note: Even when the content of the document has not changed, there still // may be side effects because of internal implementation changes. + // Note: If the document source is Google Cloud Storage URI, its metadata will + // be replaced with the custom metadata from Google Cloud Storage if the + // `import_gcs_custom_metadata` field is set to true in the request. // // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; // only use `projects.knowledgeBases.documents`. @@ -140,11 +160,16 @@ service Documents { option (google.api.http) = { post: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}:reload" body: "*" + additional_bindings { + post: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:reload" + body: "*" + } additional_bindings { post: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload" body: "*" } }; + option (google.api.method_signature) = "name,gcs_source"; option (google.longrunning.operation_info) = { response_type: "Document" metadata_type: "KnowledgeOperationMetadata" @@ -163,6 +188,7 @@ message Document { option (google.api.resource) = { type: "dialogflow.googleapis.com/Document" pattern: "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}" + pattern: "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}" }; // The status of a reload attempt. @@ -197,8 +223,8 @@ message Document { // Optional. The document resource name. // The name must be empty when creating a document. - // Format: `projects//knowledgeBases//documents/`. + // Format: `projects//locations//knowledgeBases//documents/`. string name = 1 [(google.api.field_behavior) = OPTIONAL]; // Required. The display name of the document. The name must be 1024 bytes or @@ -262,8 +288,8 @@ message Document { // Request message for [Documents.GetDocument][google.cloud.dialogflow.v2beta1.Documents.GetDocument]. message GetDocumentRequest { // Required. The name of the document to retrieve. - // Format `projects//knowledgeBases//documents/`. + // Format `projects//locations//knowledgeBases//documents/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -275,7 +301,8 @@ message GetDocumentRequest { // Request message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. message ListDocumentsRequest { // Required. The knowledge base to list all documents for. - // Format: `projects//knowledgeBases/`. + // Format: `projects//locations//knowledgeBases/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -289,6 +316,29 @@ message ListDocumentsRequest { // The next_page_token value returned from a previous list request. string page_token = 3; + + // The filter expression used to filter documents returned by the list method. + // The expression has the following syntax: + // + // [AND ] ... + // + // The following fields and operators are supported: + // + // * knowledge_types with has(:) operator + // * display_name with has(:) operator + // * state with equals(=) operator + // + // Examples: + // + // * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + // * "display_name:customer" matches documents whose display name contains + // "customer". + // * "state=ACTIVE" matches documents with ACTIVE state. + // * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; } // Response message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. @@ -303,8 +353,9 @@ message ListDocumentsResponse { // Request message for [Documents.CreateDocument][google.cloud.dialogflow.v2beta1.Documents.CreateDocument]. message CreateDocumentRequest { - // Required. The knoweldge base to create a document for. - // Format: `projects//knowledgeBases/`. + // Required. The knowledge base to create a document for. + // Format: `projects//locations//knowledgeBases/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -314,13 +365,17 @@ message CreateDocumentRequest { // Required. The document to create. Document document = 2 [(google.api.field_behavior) = REQUIRED]; + + // Whether to import custom metadata from Google Cloud Storage. + // Only valid when the document source is Google Cloud Storage URI. + bool import_gcs_custom_metadata = 3; } // Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2beta1.Documents.DeleteDocument]. message DeleteDocumentRequest { // Required. The name of the document to delete. - // Format: `projects//knowledgeBases//documents/`. + // Format: `projects//locations//knowledgeBases//documents/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -364,8 +419,8 @@ message KnowledgeOperationMetadata { // Request message for [Documents.ReloadDocument][google.cloud.dialogflow.v2beta1.Documents.ReloadDocument]. message ReloadDocumentRequest { // Required. The name of the document to reload. - // Format: `projects//knowledgeBases//documents/` + // Format: `projects//locations//knowledgeBases//documents/` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -381,16 +436,8 @@ message ReloadDocumentRequest { // If not provided, the Document's existing source will be reloaded. GcsSource gcs_source = 3; } -} - -// Response message for [Documents.AutoApproveSmartMessagingEntries]. -message AutoApproveSmartMessagingEntriesResponse { - // Number of smart messaging entries enabled. - int32 enabled_count = 1; - - // Number of smart messaging entries disabled. - int32 disabled_count = 2; - // Number of smart messaging entries unreviewed. - int32 unreviewed_count = 3; + // Whether to import custom metadata from Google Cloud Storage. + // Only valid when the document source is Google Cloud Storage URI. + bool import_gcs_custom_metadata = 4; } diff --git a/dialogflow_v2beta1/proto/entity_type.proto b/google/cloud/dialogflow_v2beta1/proto/entity_type.proto similarity index 92% rename from dialogflow_v2beta1/proto/entity_type.proto rename to google/cloud/dialogflow_v2beta1/proto/entity_type.proto index 457c85916..e1e5f8ef1 100644 --- a/dialogflow_v2beta1/proto/entity_type.proto +++ b/google/cloud/dialogflow_v2beta1/proto/entity_type.proto @@ -234,7 +234,7 @@ message EntityType { // // * A string that can contain references to other entity types (with or // without aliases). - string value = 1; + string value = 1 [(google.api.field_behavior) = REQUIRED]; // Required. A collection of value synonyms. For example, if the entity type // is *vegetable*, and `value` is *scallions*, a synonym could be *green @@ -280,7 +280,10 @@ message EntityType { // The unique identifier of the entity type. // Required for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType] and // [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes] methods. - // Format: `projects//agent/entityTypes/`. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` string name = 1; // Required. The name of the entity type. @@ -303,7 +306,9 @@ message EntityType { // The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. message ListEntityTypesRequest { // Required. The agent to list all entity types from. - // Format: `projects//agent`. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -340,7 +345,10 @@ message ListEntityTypesResponse { // The request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType]. message GetEntityTypeRequest { // Required. The name of the entity type. - // Format: `projects//agent/entityTypes/`. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -359,7 +367,9 @@ message GetEntityTypeRequest { // The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType]. message CreateEntityTypeRequest { // Required. The agent to create a entity type for. - // Format: `projects//agent`. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -397,7 +407,10 @@ message UpdateEntityTypeRequest { // The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType]. message DeleteEntityTypeRequest { // Required. The name of the entity type to delete. - // Format: `projects//agent/entityTypes/`. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -409,7 +422,9 @@ message DeleteEntityTypeRequest { // The request message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. message BatchUpdateEntityTypesRequest { // Required. The name of the agent to update or create entity types in. - // Format: `projects//agent`. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -453,8 +468,10 @@ message BatchUpdateEntityTypesResponse { // The request message for [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes]. message BatchDeleteEntityTypesRequest { - // Required. The name of the agent to delete all entities types for. Format: - // `projects//agent`. + // Required. The name of the agent to delete all entities types for. + // Supported formats: + // - `projects//agent`, + // - `projects//locations//agent`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -469,8 +486,11 @@ message BatchDeleteEntityTypesRequest { // The request message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. message BatchCreateEntitiesRequest { - // Required. The name of the entity type to create entities in. Format: - // `projects//agent/entityTypes/`. + // Required. The name of the entity type to create entities in. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -492,7 +512,10 @@ message BatchCreateEntitiesRequest { // The request message for [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities]. message BatchUpdateEntitiesRequest { // Required. The name of the entity type to update or create entities in. - // Format: `projects//agent/entityTypes/`. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -516,8 +539,11 @@ message BatchUpdateEntitiesRequest { // The request message for [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities]. message BatchDeleteEntitiesRequest { - // Required. The name of the entity type to delete entries for. Format: - // `projects//agent/entityTypes/`. + // Required. The name of the entity type to delete entries for. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/dialogflow_v2beta1/proto/environment.proto b/google/cloud/dialogflow_v2beta1/proto/environment.proto similarity index 94% rename from dialogflow_v2beta1/proto/environment.proto rename to google/cloud/dialogflow_v2beta1/proto/environment.proto index 73f4e2980..49efe6ff5 100644 --- a/dialogflow_v2beta1/proto/environment.proto +++ b/google/cloud/dialogflow_v2beta1/proto/environment.proto @@ -97,10 +97,10 @@ message Environment { } // Output only. The unique identifier of this agent environment. - // Format: + // Supported formats: // - `projects//agent/environments/` // - `projects//locations//agent/environments/` + // ID>/agent/environments/` string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; // Optional. The developer-provided description for this environment. @@ -108,7 +108,10 @@ message Environment { string description = 2 [(google.api.field_behavior) = OPTIONAL]; // Optional. The agent version loaded into this environment. - // Format: `projects//agent/versions/`. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` string agent_version = 3 [(google.api.field_behavior) = OPTIONAL]; // Output only. The state of this environment. This field is read-only, i.e., it cannot be @@ -125,8 +128,7 @@ message ListEnvironmentsRequest { // Required. The agent to list all environments from. // Format: // - `projects//agent` - // - `projects//locations//agent + // - `projects//locations//agent` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/dialogflow_v2beta1/proto/gcs.proto b/google/cloud/dialogflow_v2beta1/proto/gcs.proto similarity index 96% rename from dialogflow_v2beta1/proto/gcs.proto rename to google/cloud/dialogflow_v2beta1/proto/gcs.proto index 866b81cb0..4750a0626 100644 --- a/dialogflow_v2beta1/proto/gcs.proto +++ b/google/cloud/dialogflow_v2beta1/proto/gcs.proto @@ -16,6 +16,7 @@ syntax = "proto3"; package google.cloud.dialogflow.v2beta1; +import "google/api/field_behavior.proto"; import "google/api/annotations.proto"; option cc_enable_arenas = true; diff --git a/dialogflow_v2beta1/proto/intent.proto b/google/cloud/dialogflow_v2beta1/proto/intent.proto similarity index 97% rename from dialogflow_v2beta1/proto/intent.proto rename to google/cloud/dialogflow_v2beta1/proto/intent.proto index cfecbc142..58c3b31f8 100644 --- a/dialogflow_v2beta1/proto/intent.proto +++ b/google/cloud/dialogflow_v2beta1/proto/intent.proto @@ -120,6 +120,8 @@ service Intents { body: "*" } }; + option (google.api.method_signature) = "parent,intent_batch_uri"; + option (google.api.method_signature) = "parent,intent_batch_inline"; option (google.longrunning.operation_info) = { response_type: "google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse" metadata_type: "google.protobuf.Struct" @@ -1064,7 +1066,10 @@ message Intent { // Optional. The unique identifier of this intent. // Required for [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent] and [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents] // methods. - // Format: `projects//agent/intents/`. + // Supported formats: + // + // - `projects//agent/intents/` + // - `projects//locations//agent/intents/` string name = 1 [(google.api.field_behavior) = OPTIONAL]; // Required. The name of this intent. @@ -1093,6 +1098,7 @@ message Intent { // DEPRECATED! Please use `ml_disabled` field instead. // NOTE: If both `ml_enabled` and `ml_disabled` are either not set or false, // then the default value is determined as follows: + // // - Before April 15th, 2018 the default is: // ml_enabled = false / ml_disabled = true. // - After April 15th, 2018 the default is: @@ -1115,7 +1121,11 @@ message Intent { // Optional. The list of context names required for this intent to be // triggered. - // Format: `projects//agent/sessions/-/contexts/`. + // Formats: + // + // - `projects//agent/sessions/-/contexts/` + // - `projects//locations//agent/sessions/-/contexts/` repeated string input_context_names = 7 [(google.api.field_behavior) = OPTIONAL]; // Optional. The collection of event names that trigger the intent. @@ -1219,7 +1229,10 @@ message ListIntentsResponse { // The request message for [Intents.GetIntent][google.cloud.dialogflow.v2beta1.Intents.GetIntent]. message GetIntentRequest { // Required. The name of the intent. - // Format: `projects//agent/intents/`. + // Supported formats: + // + // - `projects//agent/intents/` + // - `projects//locations//agent/intents/` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -1241,7 +1254,10 @@ message GetIntentRequest { // The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent]. message CreateIntentRequest { // Required. The agent to create a intent for. - // Format: `projects//agent`. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -1287,7 +1303,10 @@ message DeleteIntentRequest { // Required. The name of the intent to delete. If this intent has direct or // indirect followup intents, we also delete them. // - // Format: `projects//agent/intents/`. + // Supported formats: + // + // - `projects//agent/intents/` + // - `projects//locations//agent/intents/` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -1299,7 +1318,10 @@ message DeleteIntentRequest { // The request message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. message BatchUpdateIntentsRequest { // Required. The name of the agent to update or create intents in. - // Format: `projects//agent`. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -1345,8 +1367,11 @@ message BatchUpdateIntentsResponse { // The request message for [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents]. message BatchDeleteIntentsRequest { - // Required. The name of the agent to delete all entities types for. Format: - // `projects//agent`. + // Required. The name of the agent to delete all entities types for. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/dialogflow_v2beta1/proto/knowledge_base.proto b/google/cloud/dialogflow_v2beta1/proto/knowledge_base.proto similarity index 77% rename from dialogflow_v2beta1/proto/knowledge_base.proto rename to google/cloud/dialogflow_v2beta1/proto/knowledge_base.proto index 71e72dcc5..997b2bea0 100644 --- a/dialogflow_v2beta1/proto/knowledge_base.proto +++ b/google/cloud/dialogflow_v2beta1/proto/knowledge_base.proto @@ -45,6 +45,9 @@ service KnowledgeBases { rpc ListKnowledgeBases(ListKnowledgeBasesRequest) returns (ListKnowledgeBasesResponse) { option (google.api.http) = { get: "/v2beta1/{parent=projects/*}/knowledgeBases" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/knowledgeBases" + } additional_bindings { get: "/v2beta1/{parent=projects/*/agent}/knowledgeBases" } @@ -59,6 +62,9 @@ service KnowledgeBases { rpc GetKnowledgeBase(GetKnowledgeBaseRequest) returns (KnowledgeBase) { option (google.api.http) = { get: "/v2beta1/{name=projects/*/knowledgeBases/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*}" + } additional_bindings { get: "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" } @@ -74,6 +80,10 @@ service KnowledgeBases { option (google.api.http) = { post: "/v2beta1/{parent=projects/*}/knowledgeBases" body: "knowledge_base" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/knowledgeBases" + body: "knowledge_base" + } additional_bindings { post: "/v2beta1/{parent=projects/*/agent}/knowledgeBases" body: "knowledge_base" @@ -89,6 +99,9 @@ service KnowledgeBases { rpc DeleteKnowledgeBase(DeleteKnowledgeBaseRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v2beta1/{name=projects/*/knowledgeBases/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*}" + } additional_bindings { delete: "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" } @@ -104,6 +117,10 @@ service KnowledgeBases { option (google.api.http) = { patch: "/v2beta1/{knowledge_base.name=projects/*/knowledgeBases/*}" body: "knowledge_base" + additional_bindings { + patch: "/v2beta1/{knowledge_base.name=projects/*/locations/*/knowledgeBases/*}" + body: "knowledge_base" + } additional_bindings { patch: "/v2beta1/{knowledge_base.name=projects/*/agent/knowledgeBases/*}" body: "knowledge_base" @@ -128,11 +145,13 @@ message KnowledgeBase { option (google.api.resource) = { type: "dialogflow.googleapis.com/KnowledgeBase" pattern: "projects/{project}/knowledgeBases/{knowledge_base}" + pattern: "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}" }; // The knowledge base resource name. // The name must be empty when creating a knowledge base. - // Format: `projects//knowledgeBases/`. + // Format: `projects//locations//knowledgeBases/`. string name = 1; // Required. The display name of the knowledge base. The name must be 1024 @@ -148,7 +167,7 @@ message KnowledgeBase { // Request message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. message ListKnowledgeBasesRequest { // Required. The project to list of knowledge bases for. - // Format: `projects/`. + // Format: `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -156,12 +175,40 @@ message ListKnowledgeBasesRequest { } ]; - // Optional. The maximum number of items to return in a single page. By + // The maximum number of items to return in a single page. By // default 10 and at most 100. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; - // Optional. The next_page_token value returned from a previous list request. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + // The filter expression used to filter knowledge bases returned by the list + // method. The expression has the following syntax: + // + // [AND ] ... + // + // The following fields and operators are supported: + // + // * display_name with has(:) operator + // * language_code with equals(=) operator + // + // Examples: + // + // * 'language_code=en-us' matches knowledge bases with en-us language code. + // * 'display_name:articles' matches knowledge bases whose display name + // contains "articles". + // * 'display_name:"Best Articles"' matches knowledge bases whose display + // name contains "Best Articles". + // * 'language_code=en-gb AND display_name=articles' matches all knowledge + // bases whose display name contains "articles" and whose language code is + // "en-gb". + // + // Note: An empty filter string (i.e. "") is a no-op and will result in no + // filtering. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; } // Response message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. @@ -177,7 +224,8 @@ message ListKnowledgeBasesResponse { // Request message for [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase]. message GetKnowledgeBaseRequest { // Required. The name of the knowledge base to retrieve. - // Format `projects//knowledgeBases/`. + // Format `projects//locations//knowledgeBases/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -189,7 +237,7 @@ message GetKnowledgeBaseRequest { // Request message for [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase]. message CreateKnowledgeBaseRequest { // Required. The project to create a knowledge base for. - // Format: `projects/`. + // Format: `projects//locations/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -204,7 +252,8 @@ message CreateKnowledgeBaseRequest { // Request message for [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase]. message DeleteKnowledgeBaseRequest { // Required. The name of the knowledge base to delete. - // Format: `projects//knowledgeBases/`. + // Format: `projects//locations//knowledgeBases/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -214,7 +263,7 @@ message DeleteKnowledgeBaseRequest { // Optional. Force deletes the knowledge base. When set to true, any documents // in the knowledge base are also deleted. - bool force = 2; + bool force = 2 [(google.api.field_behavior) = OPTIONAL]; } // Request message for [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase]. diff --git a/dialogflow_v2beta1/proto/session.proto b/google/cloud/dialogflow_v2beta1/proto/session.proto similarity index 90% rename from dialogflow_v2beta1/proto/session.proto rename to google/cloud/dialogflow_v2beta1/proto/session.proto index ef882e190..566824d5b 100644 --- a/dialogflow_v2beta1/proto/session.proto +++ b/google/cloud/dialogflow_v2beta1/proto/session.proto @@ -23,6 +23,7 @@ import "google/api/resource.proto"; import "google/cloud/dialogflow/v2beta1/agent.proto"; import "google/cloud/dialogflow/v2beta1/audio_config.proto"; import "google/cloud/dialogflow/v2beta1/context.proto"; +import "google/cloud/dialogflow/v2beta1/gcs.proto"; import "google/cloud/dialogflow/v2beta1/intent.proto"; import "google/cloud/dialogflow/v2beta1/session_entity_type.proto"; import "google/protobuf/duration.proto"; @@ -59,6 +60,10 @@ service Sessions { // as a result. This method is not idempotent, because it may cause contexts // and session entity types to be updated, which in turn might affect // results of future queries. + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) { option (google.api.http) = { post: "/v2beta1/{session=projects/*/agent/sessions/*}:detectIntent" @@ -82,24 +87,38 @@ service Sessions { // Processes a natural language query in audio format in a streaming fashion // and returns structured, actionable data as a result. This method is only // available via the gRPC API (not REST). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse) { } } // The request to detect user's intent. message DetectIntentRequest { - // Required. The name of the session this query is sent to. Format: - // `projects//agent/sessions/`, or - // `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - // default 'draft' environment. If `User ID` is not specified, we are using - // "-". It's up to the API caller to choose an appropriate `Session ID` and - // `User Id`. They can be a random number or some type of user and session - // identifiers (preferably hashed). The length of the `Session ID` and - // `User ID` must not exceed 36 characters. + // Required. The name of the session this query is sent to. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we are using "-". It's up to the API caller + // to choose an appropriate `Session ID` and `User Id`. They can be a random + // number or some type of user and session identifiers (preferably hashed). + // The length of the `Session ID` and `User ID` must not exceed 36 characters. // For more information, see the [API interactions // guide](https://cloud.google.com/dialogflow/docs/api-overview). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). string session = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -216,7 +235,7 @@ message QueryParameters { // Configures the type of sentiment analysis to perform. If not // provided, sentiment analysis is not performed. - // Note: Sentiment Analysis is only currently available for Enterprise Edition + // Note: Sentiment Analysis is only currently available for Essentials Edition // agents. SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10; @@ -227,7 +246,7 @@ message QueryParameters { repeated SubAgent sub_agents = 13; // This field can be used to pass HTTP headers for a webhook - // call. These headers will be sent to webhook alone with the headers that + // call. These headers will be sent to webhook along with the headers that // have been configured through Dialogflow web console. The headers defined // within this field will overwrite the headers configured through Dialogflow // console if there is a conflict. Header names are case-insensitive. @@ -461,19 +480,35 @@ message KnowledgeAnswers { // After you sent all input, you must half-close or abort the request stream. message StreamingDetectIntentRequest { // Required. The name of the session the query is sent to. - // Format of the session name: - // `projects//agent/sessions/`, or - // `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - // default 'draft' environment. If `User ID` is not specified, we are using - // "-". It's up to the API caller to choose an appropriate `Session ID` and - // `User Id`. They can be a random number or some type of user and session - // identifiers (preferably hashed). The length of the `Session ID` and - // `User ID` must not exceed 36 characters. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we are using "-". It's up to the API caller + // to choose an appropriate `Session ID` and `User Id`. They can be a random + // number or some type of user and session identifiers (preferably hashed). + // The length of the `Session ID` and `User ID` must not exceed 36 characters. // // For more information, see the [API interactions // guide](https://cloud.google.com/dialogflow/docs/api-overview). - string session = 1 [(google.api.field_behavior) = REQUIRED]; + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + string session = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Session" + } + ]; // The parameters of this query. QueryParameters query_params = 2; @@ -497,7 +532,7 @@ message StreamingDetectIntentRequest { // client should close the stream and start a new request with a new stream as // needed. // This setting is ignored when `query_input` is a piece of text or an event. - bool single_utterance = 4; + bool single_utterance = 4 [deprecated = true]; // Instructs the speech synthesizer how to generate the output // audio. If this field is not set and agent-level speech synthesizer is not @@ -668,6 +703,9 @@ message StreamingRecognitionResult { // Time offset of the end of this Speech recognition result relative to the // beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`. google.protobuf.Duration speech_end_offset = 8; + + // DTMF digits. Populated if and only if `message_type` = `DTMF_DIGITS`. + TelephonyDtmfEvents dtmf_digits = 5; } // Represents the natural language text to be processed. @@ -727,9 +765,9 @@ message SentimentAnalysisRequestConfig { // The result of sentiment analysis. Sentiment analysis inspects user input // and identifies the prevailing subjective opinion, especially to determine a // user's attitude as positive, negative, or neutral. -// For [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent], it needs to be configured in +// For [Participants.DetectIntent][], it needs to be configured in // [DetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.DetectIntentRequest.query_params]. For -// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent], it needs to be configured in +// [Participants.StreamingDetectIntent][], it needs to be configured in // [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. // And for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] and // [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent], it needs to be configured in diff --git a/dialogflow_v2beta1/proto/session_entity_type.proto b/google/cloud/dialogflow_v2beta1/proto/session_entity_type.proto similarity index 75% rename from dialogflow_v2beta1/proto/session_entity_type.proto rename to google/cloud/dialogflow_v2beta1/proto/session_entity_type.proto index 07b73530e..c80497aa0 100644 --- a/dialogflow_v2beta1/proto/session_entity_type.proto +++ b/google/cloud/dialogflow_v2beta1/proto/session_entity_type.proto @@ -194,14 +194,21 @@ message SessionEntityType { ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2; } - // Required. The unique identifier of this session entity type. Format: - // `projects//agent/sessions//entityTypes/`, or - // `projects//agent/environments//users//sessions//entityTypes/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. + // Required. The unique identifier of this session entity type. Supported + // formats: + // - `projects//agent/sessions//entityTypes/` + // - `projects//locations//agent/sessions//entityTypes/` + // - `projects//agent/environments//users//sessions//entityTypes/` + // - `projects//locations//agent/environments/ + // /users//sessions//entityTypes/` // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. // `` must be the display name of an existing entity // type in the same agent that will be overridden or supplemented. string name = 1; @@ -218,11 +225,19 @@ message SessionEntityType { // The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. message ListSessionEntityTypesRequest { // Required. The session to list all session entity types from. - // Format: `projects//agent/sessions/` or - // `projects//agent/environments//users// - // sessions/`. - // If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -251,12 +266,20 @@ message ListSessionEntityTypesResponse { // The request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType]. message GetSessionEntityTypeRequest { - // Required. The name of the session entity type. Format: - // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. + // Required. The name of the session entity type. Supported formats: + // - `projects//agent/sessions//entityTypes/` + // - `projects//locations//agent/sessions//entityTypes/` + // - `projects//agent/environments//users//sessions//entityTypes/` + // - `projects//locations//agent/environments/ + // /users//sessions//entityTypes/` + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -268,11 +291,19 @@ message GetSessionEntityTypeRequest { // The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType]. message CreateSessionEntityTypeRequest { // Required. The session to create a session entity type for. - // Format: `projects//agent/sessions/` or - // `projects//agent/environments//users// - // sessions/`. If `Environment ID` is not specified, we assume - // default 'draft' environment. If `User ID` is not specified, we assume - // default '-' user. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -295,12 +326,21 @@ message UpdateSessionEntityTypeRequest { // The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType]. message DeleteSessionEntityTypeRequest { - // Required. The name of the entity type to delete. Format: - // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' - // environment. If `User ID` is not specified, we assume default '-' user. + // Required. The name of the entity type to delete. + // Supported formats: + // - `projects//agent/sessions//entityTypes/` + // - `projects//locations//agent/sessions//entityTypes/` + // - `projects//agent/environments//users//sessions//entityTypes/` + // - `projects//locations//agent/environments/ + // /users//sessions//entityTypes/` + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/dialogflow_v2beta1/proto/validation_result.proto b/google/cloud/dialogflow_v2beta1/proto/validation_result.proto similarity index 100% rename from dialogflow_v2beta1/proto/validation_result.proto rename to google/cloud/dialogflow_v2beta1/proto/validation_result.proto diff --git a/dialogflow_v2beta1/proto/webhook.proto b/google/cloud/dialogflow_v2beta1/proto/webhook.proto similarity index 93% rename from dialogflow_v2beta1/proto/webhook.proto rename to google/cloud/dialogflow_v2beta1/proto/webhook.proto index 9e5d2a4c4..83f9d70a1 100644 --- a/dialogflow_v2beta1/proto/webhook.proto +++ b/google/cloud/dialogflow_v2beta1/proto/webhook.proto @@ -35,9 +35,15 @@ option objc_class_prefix = "DF"; message WebhookRequest { // The unique identifier of detectIntent request session. // Can be used to identify end-user inside webhook implementation. - // Format: `projects//agent/sessions/`, or - // `projects//agent/environments//users//sessions/`. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, string session = 4; // The unique identifier of the response. Contains the same value as @@ -146,8 +152,8 @@ message OriginalDetectIntentRequest { // "caller_id": "+18558363987" // } // } - // Note: The caller ID field (`caller_id`) will be redacted for Standard + // Note: The caller ID field (`caller_id`) will be redacted for Trial // Edition agents and populated with the caller ID in [E.164 - // format](https://en.wikipedia.org/wiki/E.164) for Enterprise Edition agents. + // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents. google.protobuf.Struct payload = 3; } diff --git a/google/cloud/dialogflow_v2beta1/py.typed b/google/cloud/dialogflow_v2beta1/py.typed new file mode 100644 index 000000000..2c6e5af62 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-dialogflow package uses inline types. diff --git a/google/cloud/dialogflow_v2beta1/services/__init__.py b/google/cloud/dialogflow_v2beta1/services/__init__.py new file mode 100644 index 000000000..42ffdf2bc --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/__init__.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# diff --git a/google/cloud/dialogflow_v2beta1/services/agents/__init__.py b/google/cloud/dialogflow_v2beta1/services/agents/__init__.py new file mode 100644 index 000000000..4bcbd7ac8 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/agents/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import AgentsClient +from .async_client import AgentsAsyncClient + +__all__ = ( + "AgentsClient", + "AgentsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2beta1/services/agents/async_client.py b/google/cloud/dialogflow_v2beta1/services/agents/async_client.py new file mode 100644 index 000000000..51bf46bfc --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/agents/async_client.py @@ -0,0 +1,891 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2beta1.services.agents import pagers +from google.cloud.dialogflow_v2beta1.types import agent +from google.cloud.dialogflow_v2beta1.types import agent as gcd_agent +from google.cloud.dialogflow_v2beta1.types import validation_result +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import AgentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import AgentsGrpcAsyncIOTransport +from .client import AgentsClient + + +class AgentsAsyncClient: + """Service for managing + [Agents][google.cloud.dialogflow.v2beta1.Agent]. + """ + + _client: AgentsClient + + DEFAULT_ENDPOINT = AgentsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = AgentsClient.DEFAULT_MTLS_ENDPOINT + + agent_path = staticmethod(AgentsClient.agent_path) + parse_agent_path = staticmethod(AgentsClient.parse_agent_path) + + common_billing_account_path = staticmethod(AgentsClient.common_billing_account_path) + parse_common_billing_account_path = staticmethod( + AgentsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(AgentsClient.common_folder_path) + parse_common_folder_path = staticmethod(AgentsClient.parse_common_folder_path) + + common_organization_path = staticmethod(AgentsClient.common_organization_path) + parse_common_organization_path = staticmethod( + AgentsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(AgentsClient.common_project_path) + parse_common_project_path = staticmethod(AgentsClient.parse_common_project_path) + + common_location_path = staticmethod(AgentsClient.common_location_path) + parse_common_location_path = staticmethod(AgentsClient.parse_common_location_path) + + from_service_account_file = AgentsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> AgentsTransport: + """Return the transport used by the client instance. + + Returns: + AgentsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(AgentsClient).get_transport_class, type(AgentsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, AgentsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the agents client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.AgentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = AgentsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def get_agent( + self, + request: agent.GetAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> agent.Agent: + r"""Retrieves the specified agent. + + Args: + request (:class:`~.agent.GetAgentRequest`): + The request object. The request message for + [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent]. + parent (:class:`str`): + Required. The project that the agent to fetch is + associated with. Format: ``projects/`` or + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.agent.Agent: + A Dialogflow agent is a virtual agent that handles + conversations with your end-users. It is a natural + language understanding module that understands the + nuances of human language. Dialogflow translates + end-user text or audio during a conversation to + structured data that your apps and services can + understand. You design and build a Dialogflow agent to + handle the types of conversations required for your + system. + + For more information about agents, see the `Agent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = agent.GetAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def set_agent( + self, + request: gcd_agent.SetAgentRequest = None, + *, + agent: gcd_agent.Agent = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_agent.Agent: + r"""Creates/updates the specified agent. + + Args: + request (:class:`~.gcd_agent.SetAgentRequest`): + The request object. The request message for + [Agents.SetAgent][google.cloud.dialogflow.v2beta1.Agents.SetAgent]. + agent (:class:`~.gcd_agent.Agent`): + Required. The agent to update. + This corresponds to the ``agent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_agent.Agent: + A Dialogflow agent is a virtual agent that handles + conversations with your end-users. It is a natural + language understanding module that understands the + nuances of human language. Dialogflow translates + end-user text or audio during a conversation to + structured data that your apps and services can + understand. You design and build a Dialogflow agent to + handle the types of conversations required for your + system. + + For more information about agents, see the `Agent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([agent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_agent.SetAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if agent is not None: + request.agent = agent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.set_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("agent.parent", request.agent.parent),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_agent( + self, + request: agent.DeleteAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified agent. + + Args: + request (:class:`~.agent.DeleteAgentRequest`): + The request object. The request message for + [Agents.DeleteAgent][google.cloud.dialogflow.v2beta1.Agents.DeleteAgent]. + parent (:class:`str`): + Required. The project that the agent to delete is + associated with. Format: ``projects/`` or + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = agent.DeleteAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def search_agents( + self, + request: agent.SearchAgentsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.SearchAgentsAsyncPager: + r"""Returns the list of agents. Since there is at most one + conversational agent per project, this method is useful + primarily for listing all agents across projects the caller has + access to. One can achieve that with a wildcard project + collection id "-". Refer to `List + Sub-Collections `__. + + Args: + request (:class:`~.agent.SearchAgentsRequest`): + The request object. The request message for + [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. + parent (:class:`str`): + Required. The project to list agents from. Format: + ``projects/`` or + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.SearchAgentsAsyncPager: + The response message for + [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = agent.SearchAgentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.search_agents, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.SearchAgentsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def train_agent( + self, + request: agent.TrainAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Trains the specified agent. + + Operation + + Args: + request (:class:`~.agent.TrainAgentRequest`): + The request object. The request message for + [Agents.TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent]. + parent (:class:`str`): + Required. The project that the agent to train is + associated with. Format: ``projects/`` or + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = agent.TrainAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.train_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def export_agent( + self, + request: agent.ExportAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Exports the specified agent to a ZIP file. + + Operation + + Args: + request (:class:`~.agent.ExportAgentRequest`): + The request object. The request message for + [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. + parent (:class:`str`): + Required. The project that the agent to export is + associated with. Format: ``projects/`` or + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.agent.ExportAgentResponse``: The response + message for + [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = agent.ExportAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.export_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + agent.ExportAgentResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def import_agent( + self, + request: agent.ImportAgentRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Imports the specified agent from a ZIP file. + + Uploads new intents and entity types without deleting the + existing ones. Intents and entity types with the same name are + replaced with the new versions from + [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. + After the import, the imported draft agent will be trained + automatically (unless disabled in agent settings). However, once + the import is done, training may not be completed yet. Please + call + [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when importing is complete. It only tracks when the + draft agent is updated not when it is done training. + + Args: + request (:class:`~.agent.ImportAgentRequest`): + The request object. The request message for + [Agents.ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + + request = agent.ImportAgentRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.import_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def restore_agent( + self, + request: agent.RestoreAgentRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Restores the specified agent from a ZIP file. + + Replaces the current agent version with a new one. All the + intents and entity types in the older version are deleted. After + the restore, the restored draft agent will be trained + automatically (unless disabled in agent settings). However, once + the restore is done, training may not be completed yet. Please + call + [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when restoring is complete. It only tracks when the + draft agent is updated not when it is done training. + + Args: + request (:class:`~.agent.RestoreAgentRequest`): + The request object. The request message for + [Agents.RestoreAgent][google.cloud.dialogflow.v2beta1.Agents.RestoreAgent]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + + request = agent.RestoreAgentRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.restore_agent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def get_validation_result( + self, + request: agent.GetValidationResultRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> validation_result.ValidationResult: + r"""Gets agent validation result. Agent validation is + performed during training time and is updated + automatically when training is completed. + + Args: + request (:class:`~.agent.GetValidationResultRequest`): + The request object. The request message for + [Agents.GetValidationResult][google.cloud.dialogflow.v2beta1.Agents.GetValidationResult]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.validation_result.ValidationResult: + Represents the output of agent + validation. + + """ + # Create or coerce a protobuf request object. + + request = agent.GetValidationResultRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_validation_result, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("AgentsAsyncClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/agents/client.py b/google/cloud/dialogflow_v2beta1/services/agents/client.py new file mode 100644 index 000000000..dc8a6f743 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/agents/client.py @@ -0,0 +1,1094 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2beta1.services.agents import pagers +from google.cloud.dialogflow_v2beta1.types import agent +from google.cloud.dialogflow_v2beta1.types import agent as gcd_agent +from google.cloud.dialogflow_v2beta1.types import validation_result +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import AgentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import AgentsGrpcTransport +from .transports.grpc_asyncio import AgentsGrpcAsyncIOTransport + + +class AgentsClientMeta(type): + """Metaclass for the Agents client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[AgentsTransport]] + _transport_registry["grpc"] = AgentsGrpcTransport + _transport_registry["grpc_asyncio"] = AgentsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[AgentsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class AgentsClient(metaclass=AgentsClientMeta): + """Service for managing + [Agents][google.cloud.dialogflow.v2beta1.Agent]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> AgentsTransport: + """Return the transport used by the client instance. + + Returns: + AgentsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def agent_path(project: str,) -> str: + """Return a fully-qualified agent string.""" + return "projects/{project}/agent".format(project=project,) + + @staticmethod + def parse_agent_path(path: str) -> Dict[str, str]: + """Parse a agent path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/agent$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, AgentsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the agents client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.AgentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, AgentsTransport): + # transport is a AgentsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def get_agent( + self, + request: agent.GetAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> agent.Agent: + r"""Retrieves the specified agent. + + Args: + request (:class:`~.agent.GetAgentRequest`): + The request object. The request message for + [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent]. + parent (:class:`str`): + Required. The project that the agent to fetch is + associated with. Format: ``projects/`` or + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.agent.Agent: + A Dialogflow agent is a virtual agent that handles + conversations with your end-users. It is a natural + language understanding module that understands the + nuances of human language. Dialogflow translates + end-user text or audio during a conversation to + structured data that your apps and services can + understand. You design and build a Dialogflow agent to + handle the types of conversations required for your + system. + + For more information about agents, see the `Agent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a agent.GetAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.GetAgentRequest): + request = agent.GetAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def set_agent( + self, + request: gcd_agent.SetAgentRequest = None, + *, + agent: gcd_agent.Agent = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_agent.Agent: + r"""Creates/updates the specified agent. + + Args: + request (:class:`~.gcd_agent.SetAgentRequest`): + The request object. The request message for + [Agents.SetAgent][google.cloud.dialogflow.v2beta1.Agents.SetAgent]. + agent (:class:`~.gcd_agent.Agent`): + Required. The agent to update. + This corresponds to the ``agent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_agent.Agent: + A Dialogflow agent is a virtual agent that handles + conversations with your end-users. It is a natural + language understanding module that understands the + nuances of human language. Dialogflow translates + end-user text or audio during a conversation to + structured data that your apps and services can + understand. You design and build a Dialogflow agent to + handle the types of conversations required for your + system. + + For more information about agents, see the `Agent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([agent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_agent.SetAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_agent.SetAgentRequest): + request = gcd_agent.SetAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if agent is not None: + request.agent = agent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("agent.parent", request.agent.parent),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_agent( + self, + request: agent.DeleteAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified agent. + + Args: + request (:class:`~.agent.DeleteAgentRequest`): + The request object. The request message for + [Agents.DeleteAgent][google.cloud.dialogflow.v2beta1.Agents.DeleteAgent]. + parent (:class:`str`): + Required. The project that the agent to delete is + associated with. Format: ``projects/`` or + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a agent.DeleteAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.DeleteAgentRequest): + request = agent.DeleteAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def search_agents( + self, + request: agent.SearchAgentsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.SearchAgentsPager: + r"""Returns the list of agents. Since there is at most one + conversational agent per project, this method is useful + primarily for listing all agents across projects the caller has + access to. One can achieve that with a wildcard project + collection id "-". Refer to `List + Sub-Collections `__. + + Args: + request (:class:`~.agent.SearchAgentsRequest`): + The request object. The request message for + [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. + parent (:class:`str`): + Required. The project to list agents from. Format: + ``projects/`` or + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.SearchAgentsPager: + The response message for + [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a agent.SearchAgentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.SearchAgentsRequest): + request = agent.SearchAgentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.search_agents] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.SearchAgentsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def train_agent( + self, + request: agent.TrainAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Trains the specified agent. + + Operation + + Args: + request (:class:`~.agent.TrainAgentRequest`): + The request object. The request message for + [Agents.TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent]. + parent (:class:`str`): + Required. The project that the agent to train is + associated with. Format: ``projects/`` or + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a agent.TrainAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.TrainAgentRequest): + request = agent.TrainAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.train_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def export_agent( + self, + request: agent.ExportAgentRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Exports the specified agent to a ZIP file. + + Operation + + Args: + request (:class:`~.agent.ExportAgentRequest`): + The request object. The request message for + [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. + parent (:class:`str`): + Required. The project that the agent to export is + associated with. Format: ``projects/`` or + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.agent.ExportAgentResponse``: The response + message for + [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a agent.ExportAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.ExportAgentRequest): + request = agent.ExportAgentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.export_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + agent.ExportAgentResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def import_agent( + self, + request: agent.ImportAgentRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Imports the specified agent from a ZIP file. + + Uploads new intents and entity types without deleting the + existing ones. Intents and entity types with the same name are + replaced with the new versions from + [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. + After the import, the imported draft agent will be trained + automatically (unless disabled in agent settings). However, once + the import is done, training may not be completed yet. Please + call + [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when importing is complete. It only tracks when the + draft agent is updated not when it is done training. + + Args: + request (:class:`~.agent.ImportAgentRequest`): + The request object. The request message for + [Agents.ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a agent.ImportAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.ImportAgentRequest): + request = agent.ImportAgentRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.import_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def restore_agent( + self, + request: agent.RestoreAgentRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Restores the specified agent from a ZIP file. + + Replaces the current agent version with a new one. All the + intents and entity types in the older version are deleted. After + the restore, the restored draft agent will be trained + automatically (unless disabled in agent settings). However, once + the restore is done, training may not be completed yet. Please + call + [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when restoring is complete. It only tracks when the + draft agent is updated not when it is done training. + + Args: + request (:class:`~.agent.RestoreAgentRequest`): + The request object. The request message for + [Agents.RestoreAgent][google.cloud.dialogflow.v2beta1.Agents.RestoreAgent]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a agent.RestoreAgentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.RestoreAgentRequest): + request = agent.RestoreAgentRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.restore_agent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def get_validation_result( + self, + request: agent.GetValidationResultRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> validation_result.ValidationResult: + r"""Gets agent validation result. Agent validation is + performed during training time and is updated + automatically when training is completed. + + Args: + request (:class:`~.agent.GetValidationResultRequest`): + The request object. The request message for + [Agents.GetValidationResult][google.cloud.dialogflow.v2beta1.Agents.GetValidationResult]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.validation_result.ValidationResult: + Represents the output of agent + validation. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a agent.GetValidationResultRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, agent.GetValidationResultRequest): + request = agent.GetValidationResultRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_validation_result] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("AgentsClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/agents/pagers.py b/google/cloud/dialogflow_v2beta1/services/agents/pagers.py new file mode 100644 index 000000000..e7d3832c9 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/agents/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2beta1.types import agent + + +class SearchAgentsPager: + """A pager for iterating through ``search_agents`` requests. + + This class thinly wraps an initial + :class:`~.agent.SearchAgentsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``agents`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``SearchAgents`` requests and continue to iterate + through the ``agents`` field on the + corresponding responses. + + All the usual :class:`~.agent.SearchAgentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., agent.SearchAgentsResponse], + request: agent.SearchAgentsRequest, + response: agent.SearchAgentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.agent.SearchAgentsRequest`): + The initial request object. + response (:class:`~.agent.SearchAgentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = agent.SearchAgentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[agent.SearchAgentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[agent.Agent]: + for page in self.pages: + yield from page.agents + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class SearchAgentsAsyncPager: + """A pager for iterating through ``search_agents`` requests. + + This class thinly wraps an initial + :class:`~.agent.SearchAgentsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``agents`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``SearchAgents`` requests and continue to iterate + through the ``agents`` field on the + corresponding responses. + + All the usual :class:`~.agent.SearchAgentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[agent.SearchAgentsResponse]], + request: agent.SearchAgentsRequest, + response: agent.SearchAgentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.agent.SearchAgentsRequest`): + The initial request object. + response (:class:`~.agent.SearchAgentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = agent.SearchAgentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[agent.SearchAgentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[agent.Agent]: + async def async_generator(): + async for page in self.pages: + for response in page.agents: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2beta1/services/agents/transports/__init__.py b/google/cloud/dialogflow_v2beta1/services/agents/transports/__init__.py new file mode 100644 index 000000000..a87abc01d --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/agents/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import AgentsTransport +from .grpc import AgentsGrpcTransport +from .grpc_asyncio import AgentsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[AgentsTransport]] +_transport_registry["grpc"] = AgentsGrpcTransport +_transport_registry["grpc_asyncio"] = AgentsGrpcAsyncIOTransport + + +__all__ = ( + "AgentsTransport", + "AgentsGrpcTransport", + "AgentsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2beta1/services/agents/transports/base.py b/google/cloud/dialogflow_v2beta1/services/agents/transports/base.py new file mode 100644 index 000000000..f8f8d44e3 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/agents/transports/base.py @@ -0,0 +1,240 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2beta1.types import agent +from google.cloud.dialogflow_v2beta1.types import agent as gcd_agent +from google.cloud.dialogflow_v2beta1.types import validation_result +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class AgentsTransport(abc.ABC): + """Abstract transport class for Agents.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.get_agent: gapic_v1.method.wrap_method( + self.get_agent, default_timeout=None, client_info=client_info, + ), + self.set_agent: gapic_v1.method.wrap_method( + self.set_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.search_agents: gapic_v1.method.wrap_method( + self.search_agents, default_timeout=None, client_info=client_info, + ), + self.train_agent: gapic_v1.method.wrap_method( + self.train_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.import_agent: gapic_v1.method.wrap_method( + self.import_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.get_validation_result: gapic_v1.method.wrap_method( + self.get_validation_result, + default_timeout=None, + client_info=client_info, + ), + } + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def get_agent( + self, + ) -> typing.Callable[ + [agent.GetAgentRequest], + typing.Union[agent.Agent, typing.Awaitable[agent.Agent]], + ]: + raise NotImplementedError() + + @property + def set_agent( + self, + ) -> typing.Callable[ + [gcd_agent.SetAgentRequest], + typing.Union[gcd_agent.Agent, typing.Awaitable[gcd_agent.Agent]], + ]: + raise NotImplementedError() + + @property + def delete_agent( + self, + ) -> typing.Callable[ + [agent.DeleteAgentRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def search_agents( + self, + ) -> typing.Callable[ + [agent.SearchAgentsRequest], + typing.Union[ + agent.SearchAgentsResponse, typing.Awaitable[agent.SearchAgentsResponse] + ], + ]: + raise NotImplementedError() + + @property + def train_agent( + self, + ) -> typing.Callable[ + [agent.TrainAgentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def export_agent( + self, + ) -> typing.Callable[ + [agent.ExportAgentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def import_agent( + self, + ) -> typing.Callable[ + [agent.ImportAgentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def restore_agent( + self, + ) -> typing.Callable[ + [agent.RestoreAgentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def get_validation_result( + self, + ) -> typing.Callable[ + [agent.GetValidationResultRequest], + typing.Union[ + validation_result.ValidationResult, + typing.Awaitable[validation_result.ValidationResult], + ], + ]: + raise NotImplementedError() + + +__all__ = ("AgentsTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/agents/transports/grpc.py b/google/cloud/dialogflow_v2beta1/services/agents/transports/grpc.py new file mode 100644 index 000000000..678634d85 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/agents/transports/grpc.py @@ -0,0 +1,528 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2beta1.types import agent +from google.cloud.dialogflow_v2beta1.types import agent as gcd_agent +from google.cloud.dialogflow_v2beta1.types import validation_result +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import AgentsTransport, DEFAULT_CLIENT_INFO + + +class AgentsGrpcTransport(AgentsTransport): + """gRPC backend transport for Agents. + + Service for managing + [Agents][google.cloud.dialogflow.v2beta1.Agent]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def get_agent(self) -> Callable[[agent.GetAgentRequest], agent.Agent]: + r"""Return a callable for the get agent method over gRPC. + + Retrieves the specified agent. + + Returns: + Callable[[~.GetAgentRequest], + ~.Agent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_agent" not in self._stubs: + self._stubs["get_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/GetAgent", + request_serializer=agent.GetAgentRequest.serialize, + response_deserializer=agent.Agent.deserialize, + ) + return self._stubs["get_agent"] + + @property + def set_agent(self) -> Callable[[gcd_agent.SetAgentRequest], gcd_agent.Agent]: + r"""Return a callable for the set agent method over gRPC. + + Creates/updates the specified agent. + + Returns: + Callable[[~.SetAgentRequest], + ~.Agent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "set_agent" not in self._stubs: + self._stubs["set_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/SetAgent", + request_serializer=gcd_agent.SetAgentRequest.serialize, + response_deserializer=gcd_agent.Agent.deserialize, + ) + return self._stubs["set_agent"] + + @property + def delete_agent(self) -> Callable[[agent.DeleteAgentRequest], empty.Empty]: + r"""Return a callable for the delete agent method over gRPC. + + Deletes the specified agent. + + Returns: + Callable[[~.DeleteAgentRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_agent" not in self._stubs: + self._stubs["delete_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/DeleteAgent", + request_serializer=agent.DeleteAgentRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_agent"] + + @property + def search_agents( + self, + ) -> Callable[[agent.SearchAgentsRequest], agent.SearchAgentsResponse]: + r"""Return a callable for the search agents method over gRPC. + + Returns the list of agents. Since there is at most one + conversational agent per project, this method is useful + primarily for listing all agents across projects the caller has + access to. One can achieve that with a wildcard project + collection id "-". Refer to `List + Sub-Collections `__. + + Returns: + Callable[[~.SearchAgentsRequest], + ~.SearchAgentsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "search_agents" not in self._stubs: + self._stubs["search_agents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/SearchAgents", + request_serializer=agent.SearchAgentsRequest.serialize, + response_deserializer=agent.SearchAgentsResponse.deserialize, + ) + return self._stubs["search_agents"] + + @property + def train_agent(self) -> Callable[[agent.TrainAgentRequest], operations.Operation]: + r"""Return a callable for the train agent method over gRPC. + + Trains the specified agent. + + Operation + + Returns: + Callable[[~.TrainAgentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "train_agent" not in self._stubs: + self._stubs["train_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/TrainAgent", + request_serializer=agent.TrainAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["train_agent"] + + @property + def export_agent( + self, + ) -> Callable[[agent.ExportAgentRequest], operations.Operation]: + r"""Return a callable for the export agent method over gRPC. + + Exports the specified agent to a ZIP file. + + Operation + + Returns: + Callable[[~.ExportAgentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "export_agent" not in self._stubs: + self._stubs["export_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/ExportAgent", + request_serializer=agent.ExportAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["export_agent"] + + @property + def import_agent( + self, + ) -> Callable[[agent.ImportAgentRequest], operations.Operation]: + r"""Return a callable for the import agent method over gRPC. + + Imports the specified agent from a ZIP file. + + Uploads new intents and entity types without deleting the + existing ones. Intents and entity types with the same name are + replaced with the new versions from + [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. + After the import, the imported draft agent will be trained + automatically (unless disabled in agent settings). However, once + the import is done, training may not be completed yet. Please + call + [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when importing is complete. It only tracks when the + draft agent is updated not when it is done training. + + Returns: + Callable[[~.ImportAgentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "import_agent" not in self._stubs: + self._stubs["import_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/ImportAgent", + request_serializer=agent.ImportAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["import_agent"] + + @property + def restore_agent( + self, + ) -> Callable[[agent.RestoreAgentRequest], operations.Operation]: + r"""Return a callable for the restore agent method over gRPC. + + Restores the specified agent from a ZIP file. + + Replaces the current agent version with a new one. All the + intents and entity types in the older version are deleted. After + the restore, the restored draft agent will be trained + automatically (unless disabled in agent settings). However, once + the restore is done, training may not be completed yet. Please + call + [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when restoring is complete. It only tracks when the + draft agent is updated not when it is done training. + + Returns: + Callable[[~.RestoreAgentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "restore_agent" not in self._stubs: + self._stubs["restore_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/RestoreAgent", + request_serializer=agent.RestoreAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["restore_agent"] + + @property + def get_validation_result( + self, + ) -> Callable[ + [agent.GetValidationResultRequest], validation_result.ValidationResult + ]: + r"""Return a callable for the get validation result method over gRPC. + + Gets agent validation result. Agent validation is + performed during training time and is updated + automatically when training is completed. + + Returns: + Callable[[~.GetValidationResultRequest], + ~.ValidationResult]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_validation_result" not in self._stubs: + self._stubs["get_validation_result"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/GetValidationResult", + request_serializer=agent.GetValidationResultRequest.serialize, + response_deserializer=validation_result.ValidationResult.deserialize, + ) + return self._stubs["get_validation_result"] + + +__all__ = ("AgentsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/agents/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2beta1/services/agents/transports/grpc_asyncio.py new file mode 100644 index 000000000..a82040d26 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/agents/transports/grpc_asyncio.py @@ -0,0 +1,539 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import operations_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2beta1.types import agent +from google.cloud.dialogflow_v2beta1.types import agent as gcd_agent +from google.cloud.dialogflow_v2beta1.types import validation_result +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import AgentsTransport, DEFAULT_CLIENT_INFO +from .grpc import AgentsGrpcTransport + + +class AgentsGrpcAsyncIOTransport(AgentsTransport): + """gRPC AsyncIO backend transport for Agents. + + Service for managing + [Agents][google.cloud.dialogflow.v2beta1.Agent]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def get_agent(self) -> Callable[[agent.GetAgentRequest], Awaitable[agent.Agent]]: + r"""Return a callable for the get agent method over gRPC. + + Retrieves the specified agent. + + Returns: + Callable[[~.GetAgentRequest], + Awaitable[~.Agent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_agent" not in self._stubs: + self._stubs["get_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/GetAgent", + request_serializer=agent.GetAgentRequest.serialize, + response_deserializer=agent.Agent.deserialize, + ) + return self._stubs["get_agent"] + + @property + def set_agent( + self, + ) -> Callable[[gcd_agent.SetAgentRequest], Awaitable[gcd_agent.Agent]]: + r"""Return a callable for the set agent method over gRPC. + + Creates/updates the specified agent. + + Returns: + Callable[[~.SetAgentRequest], + Awaitable[~.Agent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "set_agent" not in self._stubs: + self._stubs["set_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/SetAgent", + request_serializer=gcd_agent.SetAgentRequest.serialize, + response_deserializer=gcd_agent.Agent.deserialize, + ) + return self._stubs["set_agent"] + + @property + def delete_agent( + self, + ) -> Callable[[agent.DeleteAgentRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete agent method over gRPC. + + Deletes the specified agent. + + Returns: + Callable[[~.DeleteAgentRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_agent" not in self._stubs: + self._stubs["delete_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/DeleteAgent", + request_serializer=agent.DeleteAgentRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_agent"] + + @property + def search_agents( + self, + ) -> Callable[[agent.SearchAgentsRequest], Awaitable[agent.SearchAgentsResponse]]: + r"""Return a callable for the search agents method over gRPC. + + Returns the list of agents. Since there is at most one + conversational agent per project, this method is useful + primarily for listing all agents across projects the caller has + access to. One can achieve that with a wildcard project + collection id "-". Refer to `List + Sub-Collections `__. + + Returns: + Callable[[~.SearchAgentsRequest], + Awaitable[~.SearchAgentsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "search_agents" not in self._stubs: + self._stubs["search_agents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/SearchAgents", + request_serializer=agent.SearchAgentsRequest.serialize, + response_deserializer=agent.SearchAgentsResponse.deserialize, + ) + return self._stubs["search_agents"] + + @property + def train_agent( + self, + ) -> Callable[[agent.TrainAgentRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the train agent method over gRPC. + + Trains the specified agent. + + Operation + + Returns: + Callable[[~.TrainAgentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "train_agent" not in self._stubs: + self._stubs["train_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/TrainAgent", + request_serializer=agent.TrainAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["train_agent"] + + @property + def export_agent( + self, + ) -> Callable[[agent.ExportAgentRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the export agent method over gRPC. + + Exports the specified agent to a ZIP file. + + Operation + + Returns: + Callable[[~.ExportAgentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "export_agent" not in self._stubs: + self._stubs["export_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/ExportAgent", + request_serializer=agent.ExportAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["export_agent"] + + @property + def import_agent( + self, + ) -> Callable[[agent.ImportAgentRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the import agent method over gRPC. + + Imports the specified agent from a ZIP file. + + Uploads new intents and entity types without deleting the + existing ones. Intents and entity types with the same name are + replaced with the new versions from + [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. + After the import, the imported draft agent will be trained + automatically (unless disabled in agent settings). However, once + the import is done, training may not be completed yet. Please + call + [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when importing is complete. It only tracks when the + draft agent is updated not when it is done training. + + Returns: + Callable[[~.ImportAgentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "import_agent" not in self._stubs: + self._stubs["import_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/ImportAgent", + request_serializer=agent.ImportAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["import_agent"] + + @property + def restore_agent( + self, + ) -> Callable[[agent.RestoreAgentRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the restore agent method over gRPC. + + Restores the specified agent from a ZIP file. + + Replaces the current agent version with a new one. All the + intents and entity types in the older version are deleted. After + the restore, the restored draft agent will be trained + automatically (unless disabled in agent settings). However, once + the restore is done, training may not be completed yet. Please + call + [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] + and wait for the operation it returns in order to train + explicitly. + + Operation An operation + which tracks when restoring is complete. It only tracks when the + draft agent is updated not when it is done training. + + Returns: + Callable[[~.RestoreAgentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "restore_agent" not in self._stubs: + self._stubs["restore_agent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/RestoreAgent", + request_serializer=agent.RestoreAgentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["restore_agent"] + + @property + def get_validation_result( + self, + ) -> Callable[ + [agent.GetValidationResultRequest], + Awaitable[validation_result.ValidationResult], + ]: + r"""Return a callable for the get validation result method over gRPC. + + Gets agent validation result. Agent validation is + performed during training time and is updated + automatically when training is completed. + + Returns: + Callable[[~.GetValidationResultRequest], + Awaitable[~.ValidationResult]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_validation_result" not in self._stubs: + self._stubs["get_validation_result"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Agents/GetValidationResult", + request_serializer=agent.GetValidationResultRequest.serialize, + response_deserializer=validation_result.ValidationResult.deserialize, + ) + return self._stubs["get_validation_result"] + + +__all__ = ("AgentsGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/contexts/__init__.py b/google/cloud/dialogflow_v2beta1/services/contexts/__init__.py new file mode 100644 index 000000000..56b19b0f2 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/contexts/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import ContextsClient +from .async_client import ContextsAsyncClient + +__all__ = ( + "ContextsClient", + "ContextsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2beta1/services/contexts/async_client.py b/google/cloud/dialogflow_v2beta1/services/contexts/async_client.py new file mode 100644 index 000000000..1bb413794 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/contexts/async_client.py @@ -0,0 +1,699 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2beta1.services.contexts import pagers +from google.cloud.dialogflow_v2beta1.types import context +from google.cloud.dialogflow_v2beta1.types import context as gcd_context +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import ContextsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import ContextsGrpcAsyncIOTransport +from .client import ContextsClient + + +class ContextsAsyncClient: + """Service for managing + [Contexts][google.cloud.dialogflow.v2beta1.Context]. + """ + + _client: ContextsClient + + DEFAULT_ENDPOINT = ContextsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = ContextsClient.DEFAULT_MTLS_ENDPOINT + + context_path = staticmethod(ContextsClient.context_path) + parse_context_path = staticmethod(ContextsClient.parse_context_path) + + common_billing_account_path = staticmethod( + ContextsClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + ContextsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(ContextsClient.common_folder_path) + parse_common_folder_path = staticmethod(ContextsClient.parse_common_folder_path) + + common_organization_path = staticmethod(ContextsClient.common_organization_path) + parse_common_organization_path = staticmethod( + ContextsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(ContextsClient.common_project_path) + parse_common_project_path = staticmethod(ContextsClient.parse_common_project_path) + + common_location_path = staticmethod(ContextsClient.common_location_path) + parse_common_location_path = staticmethod(ContextsClient.parse_common_location_path) + + from_service_account_file = ContextsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> ContextsTransport: + """Return the transport used by the client instance. + + Returns: + ContextsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(ContextsClient).get_transport_class, type(ContextsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, ContextsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the contexts client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.ContextsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = ContextsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_contexts( + self, + request: context.ListContextsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListContextsAsyncPager: + r"""Returns the list of all contexts in the specified + session. + + Args: + request (:class:`~.context.ListContextsRequest`): + The request object. The request message for + [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. + parent (:class:`str`): + Required. The session to list all contexts from. + Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListContextsAsyncPager: + The response message for + [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = context.ListContextsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_contexts, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.ListContextsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_context( + self, + request: context.GetContextRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> context.Context: + r"""Retrieves the specified context. + + Args: + request (:class:`~.context.GetContextRequest`): + The request object. The request message for + [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext]. + name (:class:`str`): + Required. The name of the context. Supported formats: + + - ``projects//agent/sessions//contexts/``, + - ``projects//locations//agent/sessions//contexts/``, + - ``projects//agent/environments//users//sessions//contexts/``, + - ``projects//locations//agent/environments//users//sessions//contexts/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = context.GetContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_context, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_context( + self, + request: gcd_context.CreateContextRequest = None, + *, + parent: str = None, + context: gcd_context.Context = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_context.Context: + r"""Creates a context. + If the specified context already exists, overrides the + context. + + Args: + request (:class:`~.gcd_context.CreateContextRequest`): + The request object. The request message for + [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext]. + parent (:class:`str`): + Required. The session to create a context for. Supported + formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + context (:class:`~.gcd_context.Context`): + Required. The context to create. + This corresponds to the ``context`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, context]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_context.CreateContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if context is not None: + request.context = context + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_context, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def update_context( + self, + request: gcd_context.UpdateContextRequest = None, + *, + context: gcd_context.Context = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_context.Context: + r"""Updates the specified context. + + Args: + request (:class:`~.gcd_context.UpdateContextRequest`): + The request object. The request message for + [Contexts.UpdateContext][google.cloud.dialogflow.v2beta1.Contexts.UpdateContext]. + context (:class:`~.gcd_context.Context`): + Required. The context to update. + This corresponds to the ``context`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([context, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_context.UpdateContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if context is not None: + request.context = context + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_context, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("context.name", request.context.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_context( + self, + request: context.DeleteContextRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified context. + + Args: + request (:class:`~.context.DeleteContextRequest`): + The request object. The request message for + [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext]. + name (:class:`str`): + Required. The name of the context to delete. Supported + formats: + + - ``projects//agent/sessions//contexts/``, + - ``projects//locations//agent/sessions//contexts/``, + - ``projects//agent/environments//users//sessions//contexts/``, + - ``projects//locations//agent/environments//users//sessions//contexts/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = context.DeleteContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_context, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def delete_all_contexts( + self, + request: context.DeleteAllContextsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes all active contexts in the specified session. + + Args: + request (:class:`~.context.DeleteAllContextsRequest`): + The request object. The request message for + [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts]. + parent (:class:`str`): + Required. The name of the session to delete all contexts + from. Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified we + assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = context.DeleteAllContextsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_all_contexts, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("ContextsAsyncClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/contexts/client.py b/google/cloud/dialogflow_v2beta1/services/contexts/client.py new file mode 100644 index 000000000..faa8fe6b5 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/contexts/client.py @@ -0,0 +1,902 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2beta1.services.contexts import pagers +from google.cloud.dialogflow_v2beta1.types import context +from google.cloud.dialogflow_v2beta1.types import context as gcd_context +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import ContextsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import ContextsGrpcTransport +from .transports.grpc_asyncio import ContextsGrpcAsyncIOTransport + + +class ContextsClientMeta(type): + """Metaclass for the Contexts client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[ContextsTransport]] + _transport_registry["grpc"] = ContextsGrpcTransport + _transport_registry["grpc_asyncio"] = ContextsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[ContextsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class ContextsClient(metaclass=ContextsClientMeta): + """Service for managing + [Contexts][google.cloud.dialogflow.v2beta1.Context]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> ContextsTransport: + """Return the transport used by the client instance. + + Returns: + ContextsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def context_path(project: str, session: str, context: str,) -> str: + """Return a fully-qualified context string.""" + return "projects/{project}/agent/sessions/{session}/contexts/{context}".format( + project=project, session=session, context=context, + ) + + @staticmethod + def parse_context_path(path: str) -> Dict[str, str]: + """Parse a context path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/contexts/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, ContextsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the contexts client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.ContextsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, ContextsTransport): + # transport is a ContextsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_contexts( + self, + request: context.ListContextsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListContextsPager: + r"""Returns the list of all contexts in the specified + session. + + Args: + request (:class:`~.context.ListContextsRequest`): + The request object. The request message for + [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. + parent (:class:`str`): + Required. The session to list all contexts from. + Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListContextsPager: + The response message for + [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a context.ListContextsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, context.ListContextsRequest): + request = context.ListContextsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_contexts] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.ListContextsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def get_context( + self, + request: context.GetContextRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> context.Context: + r"""Retrieves the specified context. + + Args: + request (:class:`~.context.GetContextRequest`): + The request object. The request message for + [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext]. + name (:class:`str`): + Required. The name of the context. Supported formats: + + - ``projects//agent/sessions//contexts/``, + - ``projects//locations//agent/sessions//contexts/``, + - ``projects//agent/environments//users//sessions//contexts/``, + - ``projects//locations//agent/environments//users//sessions//contexts/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a context.GetContextRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, context.GetContextRequest): + request = context.GetContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_context] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_context( + self, + request: gcd_context.CreateContextRequest = None, + *, + parent: str = None, + context: gcd_context.Context = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_context.Context: + r"""Creates a context. + If the specified context already exists, overrides the + context. + + Args: + request (:class:`~.gcd_context.CreateContextRequest`): + The request object. The request message for + [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext]. + parent (:class:`str`): + Required. The session to create a context for. Supported + formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + context (:class:`~.gcd_context.Context`): + Required. The context to create. + This corresponds to the ``context`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, context]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_context.CreateContextRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_context.CreateContextRequest): + request = gcd_context.CreateContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if context is not None: + request.context = context + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_context] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def update_context( + self, + request: gcd_context.UpdateContextRequest = None, + *, + context: gcd_context.Context = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_context.Context: + r"""Updates the specified context. + + Args: + request (:class:`~.gcd_context.UpdateContextRequest`): + The request object. The request message for + [Contexts.UpdateContext][google.cloud.dialogflow.v2beta1.Contexts.UpdateContext]. + context (:class:`~.gcd_context.Context`): + Required. The context to update. + This corresponds to the ``context`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_context.Context: + Dialogflow contexts are similar to natural language + context. If a person says to you "they are orange", you + need context in order to understand what "they" is + referring to. Similarly, for Dialogflow to handle an + end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a + conversation. You can configure contexts for an intent + by setting input and output contexts, which are + identified by string names. When an intent is matched, + any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is + more likely to match intents that are configured with + input contexts that correspond to the currently active + contexts. + + For more information about context, see the `Contexts + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([context, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_context.UpdateContextRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_context.UpdateContextRequest): + request = gcd_context.UpdateContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if context is not None: + request.context = context + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_context] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("context.name", request.context.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_context( + self, + request: context.DeleteContextRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified context. + + Args: + request (:class:`~.context.DeleteContextRequest`): + The request object. The request message for + [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext]. + name (:class:`str`): + Required. The name of the context to delete. Supported + formats: + + - ``projects//agent/sessions//contexts/``, + - ``projects//locations//agent/sessions//contexts/``, + - ``projects//agent/environments//users//sessions//contexts/``, + - ``projects//locations//agent/environments//users//sessions//contexts/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a context.DeleteContextRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, context.DeleteContextRequest): + request = context.DeleteContextRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_context] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def delete_all_contexts( + self, + request: context.DeleteAllContextsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes all active contexts in the specified session. + + Args: + request (:class:`~.context.DeleteAllContextsRequest`): + The request object. The request message for + [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts]. + parent (:class:`str`): + Required. The name of the session to delete all contexts + from. Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified we + assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a context.DeleteAllContextsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, context.DeleteAllContextsRequest): + request = context.DeleteAllContextsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_all_contexts] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("ContextsClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/contexts/pagers.py b/google/cloud/dialogflow_v2beta1/services/contexts/pagers.py new file mode 100644 index 000000000..84c0ae735 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/contexts/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2beta1.types import context + + +class ListContextsPager: + """A pager for iterating through ``list_contexts`` requests. + + This class thinly wraps an initial + :class:`~.context.ListContextsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``contexts`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListContexts`` requests and continue to iterate + through the ``contexts`` field on the + corresponding responses. + + All the usual :class:`~.context.ListContextsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., context.ListContextsResponse], + request: context.ListContextsRequest, + response: context.ListContextsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.context.ListContextsRequest`): + The initial request object. + response (:class:`~.context.ListContextsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = context.ListContextsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[context.ListContextsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[context.Context]: + for page in self.pages: + yield from page.contexts + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListContextsAsyncPager: + """A pager for iterating through ``list_contexts`` requests. + + This class thinly wraps an initial + :class:`~.context.ListContextsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``contexts`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListContexts`` requests and continue to iterate + through the ``contexts`` field on the + corresponding responses. + + All the usual :class:`~.context.ListContextsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[context.ListContextsResponse]], + request: context.ListContextsRequest, + response: context.ListContextsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.context.ListContextsRequest`): + The initial request object. + response (:class:`~.context.ListContextsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = context.ListContextsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[context.ListContextsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[context.Context]: + async def async_generator(): + async for page in self.pages: + for response in page.contexts: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2beta1/services/contexts/transports/__init__.py b/google/cloud/dialogflow_v2beta1/services/contexts/transports/__init__.py new file mode 100644 index 000000000..845f386d7 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/contexts/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import ContextsTransport +from .grpc import ContextsGrpcTransport +from .grpc_asyncio import ContextsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[ContextsTransport]] +_transport_registry["grpc"] = ContextsGrpcTransport +_transport_registry["grpc_asyncio"] = ContextsGrpcAsyncIOTransport + + +__all__ = ( + "ContextsTransport", + "ContextsGrpcTransport", + "ContextsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2beta1/services/contexts/transports/base.py b/google/cloud/dialogflow_v2beta1/services/contexts/transports/base.py new file mode 100644 index 000000000..664f3e3fc --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/contexts/transports/base.py @@ -0,0 +1,191 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2beta1.types import context +from google.cloud.dialogflow_v2beta1.types import context as gcd_context +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class ContextsTransport(abc.ABC): + """Abstract transport class for Contexts.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_contexts: gapic_v1.method.wrap_method( + self.list_contexts, default_timeout=None, client_info=client_info, + ), + self.get_context: gapic_v1.method.wrap_method( + self.get_context, default_timeout=None, client_info=client_info, + ), + self.create_context: gapic_v1.method.wrap_method( + self.create_context, default_timeout=None, client_info=client_info, + ), + self.update_context: gapic_v1.method.wrap_method( + self.update_context, default_timeout=None, client_info=client_info, + ), + self.delete_context: gapic_v1.method.wrap_method( + self.delete_context, default_timeout=None, client_info=client_info, + ), + self.delete_all_contexts: gapic_v1.method.wrap_method( + self.delete_all_contexts, default_timeout=None, client_info=client_info, + ), + } + + @property + def list_contexts( + self, + ) -> typing.Callable[ + [context.ListContextsRequest], + typing.Union[ + context.ListContextsResponse, typing.Awaitable[context.ListContextsResponse] + ], + ]: + raise NotImplementedError() + + @property + def get_context( + self, + ) -> typing.Callable[ + [context.GetContextRequest], + typing.Union[context.Context, typing.Awaitable[context.Context]], + ]: + raise NotImplementedError() + + @property + def create_context( + self, + ) -> typing.Callable[ + [gcd_context.CreateContextRequest], + typing.Union[gcd_context.Context, typing.Awaitable[gcd_context.Context]], + ]: + raise NotImplementedError() + + @property + def update_context( + self, + ) -> typing.Callable[ + [gcd_context.UpdateContextRequest], + typing.Union[gcd_context.Context, typing.Awaitable[gcd_context.Context]], + ]: + raise NotImplementedError() + + @property + def delete_context( + self, + ) -> typing.Callable[ + [context.DeleteContextRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def delete_all_contexts( + self, + ) -> typing.Callable[ + [context.DeleteAllContextsRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + +__all__ = ("ContextsTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/contexts/transports/grpc.py b/google/cloud/dialogflow_v2beta1/services/contexts/transports/grpc.py new file mode 100644 index 000000000..8f2c3a113 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/contexts/transports/grpc.py @@ -0,0 +1,391 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2beta1.types import context +from google.cloud.dialogflow_v2beta1.types import context as gcd_context +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import ContextsTransport, DEFAULT_CLIENT_INFO + + +class ContextsGrpcTransport(ContextsTransport): + """gRPC backend transport for Contexts. + + Service for managing + [Contexts][google.cloud.dialogflow.v2beta1.Context]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def list_contexts( + self, + ) -> Callable[[context.ListContextsRequest], context.ListContextsResponse]: + r"""Return a callable for the list contexts method over gRPC. + + Returns the list of all contexts in the specified + session. + + Returns: + Callable[[~.ListContextsRequest], + ~.ListContextsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_contexts" not in self._stubs: + self._stubs["list_contexts"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/ListContexts", + request_serializer=context.ListContextsRequest.serialize, + response_deserializer=context.ListContextsResponse.deserialize, + ) + return self._stubs["list_contexts"] + + @property + def get_context(self) -> Callable[[context.GetContextRequest], context.Context]: + r"""Return a callable for the get context method over gRPC. + + Retrieves the specified context. + + Returns: + Callable[[~.GetContextRequest], + ~.Context]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_context" not in self._stubs: + self._stubs["get_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/GetContext", + request_serializer=context.GetContextRequest.serialize, + response_deserializer=context.Context.deserialize, + ) + return self._stubs["get_context"] + + @property + def create_context( + self, + ) -> Callable[[gcd_context.CreateContextRequest], gcd_context.Context]: + r"""Return a callable for the create context method over gRPC. + + Creates a context. + If the specified context already exists, overrides the + context. + + Returns: + Callable[[~.CreateContextRequest], + ~.Context]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_context" not in self._stubs: + self._stubs["create_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/CreateContext", + request_serializer=gcd_context.CreateContextRequest.serialize, + response_deserializer=gcd_context.Context.deserialize, + ) + return self._stubs["create_context"] + + @property + def update_context( + self, + ) -> Callable[[gcd_context.UpdateContextRequest], gcd_context.Context]: + r"""Return a callable for the update context method over gRPC. + + Updates the specified context. + + Returns: + Callable[[~.UpdateContextRequest], + ~.Context]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_context" not in self._stubs: + self._stubs["update_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/UpdateContext", + request_serializer=gcd_context.UpdateContextRequest.serialize, + response_deserializer=gcd_context.Context.deserialize, + ) + return self._stubs["update_context"] + + @property + def delete_context(self) -> Callable[[context.DeleteContextRequest], empty.Empty]: + r"""Return a callable for the delete context method over gRPC. + + Deletes the specified context. + + Returns: + Callable[[~.DeleteContextRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_context" not in self._stubs: + self._stubs["delete_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/DeleteContext", + request_serializer=context.DeleteContextRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_context"] + + @property + def delete_all_contexts( + self, + ) -> Callable[[context.DeleteAllContextsRequest], empty.Empty]: + r"""Return a callable for the delete all contexts method over gRPC. + + Deletes all active contexts in the specified session. + + Returns: + Callable[[~.DeleteAllContextsRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_all_contexts" not in self._stubs: + self._stubs["delete_all_contexts"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/DeleteAllContexts", + request_serializer=context.DeleteAllContextsRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_all_contexts"] + + +__all__ = ("ContextsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/contexts/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2beta1/services/contexts/transports/grpc_asyncio.py new file mode 100644 index 000000000..f6d1c6f2b --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/contexts/transports/grpc_asyncio.py @@ -0,0 +1,401 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2beta1.types import context +from google.cloud.dialogflow_v2beta1.types import context as gcd_context +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import ContextsTransport, DEFAULT_CLIENT_INFO +from .grpc import ContextsGrpcTransport + + +class ContextsGrpcAsyncIOTransport(ContextsTransport): + """gRPC AsyncIO backend transport for Contexts. + + Service for managing + [Contexts][google.cloud.dialogflow.v2beta1.Context]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def list_contexts( + self, + ) -> Callable[ + [context.ListContextsRequest], Awaitable[context.ListContextsResponse] + ]: + r"""Return a callable for the list contexts method over gRPC. + + Returns the list of all contexts in the specified + session. + + Returns: + Callable[[~.ListContextsRequest], + Awaitable[~.ListContextsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_contexts" not in self._stubs: + self._stubs["list_contexts"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/ListContexts", + request_serializer=context.ListContextsRequest.serialize, + response_deserializer=context.ListContextsResponse.deserialize, + ) + return self._stubs["list_contexts"] + + @property + def get_context( + self, + ) -> Callable[[context.GetContextRequest], Awaitable[context.Context]]: + r"""Return a callable for the get context method over gRPC. + + Retrieves the specified context. + + Returns: + Callable[[~.GetContextRequest], + Awaitable[~.Context]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_context" not in self._stubs: + self._stubs["get_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/GetContext", + request_serializer=context.GetContextRequest.serialize, + response_deserializer=context.Context.deserialize, + ) + return self._stubs["get_context"] + + @property + def create_context( + self, + ) -> Callable[[gcd_context.CreateContextRequest], Awaitable[gcd_context.Context]]: + r"""Return a callable for the create context method over gRPC. + + Creates a context. + If the specified context already exists, overrides the + context. + + Returns: + Callable[[~.CreateContextRequest], + Awaitable[~.Context]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_context" not in self._stubs: + self._stubs["create_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/CreateContext", + request_serializer=gcd_context.CreateContextRequest.serialize, + response_deserializer=gcd_context.Context.deserialize, + ) + return self._stubs["create_context"] + + @property + def update_context( + self, + ) -> Callable[[gcd_context.UpdateContextRequest], Awaitable[gcd_context.Context]]: + r"""Return a callable for the update context method over gRPC. + + Updates the specified context. + + Returns: + Callable[[~.UpdateContextRequest], + Awaitable[~.Context]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_context" not in self._stubs: + self._stubs["update_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/UpdateContext", + request_serializer=gcd_context.UpdateContextRequest.serialize, + response_deserializer=gcd_context.Context.deserialize, + ) + return self._stubs["update_context"] + + @property + def delete_context( + self, + ) -> Callable[[context.DeleteContextRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete context method over gRPC. + + Deletes the specified context. + + Returns: + Callable[[~.DeleteContextRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_context" not in self._stubs: + self._stubs["delete_context"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/DeleteContext", + request_serializer=context.DeleteContextRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_context"] + + @property + def delete_all_contexts( + self, + ) -> Callable[[context.DeleteAllContextsRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete all contexts method over gRPC. + + Deletes all active contexts in the specified session. + + Returns: + Callable[[~.DeleteAllContextsRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_all_contexts" not in self._stubs: + self._stubs["delete_all_contexts"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Contexts/DeleteAllContexts", + request_serializer=context.DeleteAllContextsRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_all_contexts"] + + +__all__ = ("ContextsGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/documents/__init__.py b/google/cloud/dialogflow_v2beta1/services/documents/__init__.py new file mode 100644 index 000000000..5f6db6815 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/documents/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import DocumentsClient +from .async_client import DocumentsAsyncClient + +__all__ = ( + "DocumentsClient", + "DocumentsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2beta1/services/documents/async_client.py b/google/cloud/dialogflow_v2beta1/services/documents/async_client.py new file mode 100644 index 000000000..fd7a43483 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/documents/async_client.py @@ -0,0 +1,742 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2beta1.services.documents import pagers +from google.cloud.dialogflow_v2beta1.types import document +from google.cloud.dialogflow_v2beta1.types import document as gcd_document +from google.cloud.dialogflow_v2beta1.types import gcs +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + +from .transports.base import DocumentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import DocumentsGrpcAsyncIOTransport +from .client import DocumentsClient + + +class DocumentsAsyncClient: + """Service for managing knowledge + [Documents][google.cloud.dialogflow.v2beta1.Document]. + """ + + _client: DocumentsClient + + DEFAULT_ENDPOINT = DocumentsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = DocumentsClient.DEFAULT_MTLS_ENDPOINT + + document_path = staticmethod(DocumentsClient.document_path) + parse_document_path = staticmethod(DocumentsClient.parse_document_path) + + common_billing_account_path = staticmethod( + DocumentsClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + DocumentsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(DocumentsClient.common_folder_path) + parse_common_folder_path = staticmethod(DocumentsClient.parse_common_folder_path) + + common_organization_path = staticmethod(DocumentsClient.common_organization_path) + parse_common_organization_path = staticmethod( + DocumentsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(DocumentsClient.common_project_path) + parse_common_project_path = staticmethod(DocumentsClient.parse_common_project_path) + + common_location_path = staticmethod(DocumentsClient.common_location_path) + parse_common_location_path = staticmethod( + DocumentsClient.parse_common_location_path + ) + + from_service_account_file = DocumentsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> DocumentsTransport: + """Return the transport used by the client instance. + + Returns: + DocumentsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(DocumentsClient).get_transport_class, type(DocumentsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, DocumentsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the documents client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.DocumentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = DocumentsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_documents( + self, + request: document.ListDocumentsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListDocumentsAsyncPager: + r"""Returns the list of all documents of the knowledge base. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.document.ListDocumentsRequest`): + The request object. Request message for + [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. + parent (:class:`str`): + Required. The knowledge base to list all documents for. + Format: + ``projects//locations//knowledgeBases/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListDocumentsAsyncPager: + Response message for + [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = document.ListDocumentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_documents, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.ListDocumentsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_document( + self, + request: document.GetDocumentRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> document.Document: + r"""Retrieves the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.document.GetDocumentRequest`): + The request object. Request message for + [Documents.GetDocument][google.cloud.dialogflow.v2beta1.Documents.GetDocument]. + name (:class:`str`): + Required. The name of the document to retrieve. Format + ``projects//locations//knowledgeBases//documents/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.document.Document: + A knowledge document to be used by a + [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases.documents`` + resource is deprecated; only use + ``projects.knowledgeBases.documents``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = document.GetDocumentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_document, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_document( + self, + request: gcd_document.CreateDocumentRequest = None, + *, + parent: str = None, + document: gcd_document.Document = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates a new document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.gcd_document.CreateDocumentRequest`): + The request object. Request message for + [Documents.CreateDocument][google.cloud.dialogflow.v2beta1.Documents.CreateDocument]. + parent (:class:`str`): + Required. The knowledge base to create a document for. + Format: + ``projects//locations//knowledgeBases/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + document (:class:`~.gcd_document.Document`): + Required. The document to create. + This corresponds to the ``document`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.gcd_document.Document``: A knowledge document + to be used by a + [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases.documents`` + resource is deprecated; only use + ``projects.knowledgeBases.documents``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, document]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_document.CreateDocumentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if document is not None: + request.document = document + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_document, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + gcd_document.Document, + metadata_type=gcd_document.KnowledgeOperationMetadata, + ) + + # Done; return the response. + return response + + async def delete_document( + self, + request: document.DeleteDocumentRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.document.DeleteDocumentRequest`): + The request object. Request message for + [Documents.DeleteDocument][google.cloud.dialogflow.v2beta1.Documents.DeleteDocument]. + name (:class:`str`): + Required. The name of the document to delete. Format: + ``projects//locations//knowledgeBases//documents/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = document.DeleteDocumentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_document, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=document.KnowledgeOperationMetadata, + ) + + # Done; return the response. + return response + + async def update_document( + self, + request: gcd_document.UpdateDocumentRequest = None, + *, + document: gcd_document.Document = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.gcd_document.UpdateDocumentRequest`): + The request object. Request message for + [Documents.UpdateDocument][google.cloud.dialogflow.v2beta1.Documents.UpdateDocument]. + document (:class:`~.gcd_document.Document`): + Required. The document to update. + This corresponds to the ``document`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. Not specified means ``update all``. Currently, + only ``display_name`` can be updated, an InvalidArgument + will be returned for attempting to update other fields. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.gcd_document.Document``: A knowledge document + to be used by a + [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases.documents`` + resource is deprecated; only use + ``projects.knowledgeBases.documents``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([document, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_document.UpdateDocumentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if document is not None: + request.document = document + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_document, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("document.name", request.document.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + gcd_document.Document, + metadata_type=gcd_document.KnowledgeOperationMetadata, + ) + + # Done; return the response. + return response + + async def reload_document( + self, + request: document.ReloadDocumentRequest = None, + *, + name: str = None, + gcs_source: gcs.GcsSource = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Reloads the specified document from its specified source, + content_uri or content. The previously loaded content of the + document will be deleted. Note: Even when the content of the + document has not changed, there still may be side effects + because of internal implementation changes. Note: If the + document source is Google Cloud Storage URI, its metadata will + be replaced with the custom metadata from Google Cloud Storage + if the ``import_gcs_custom_metadata`` field is set to true in + the request. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.document.ReloadDocumentRequest`): + The request object. Request message for + [Documents.ReloadDocument][google.cloud.dialogflow.v2beta1.Documents.ReloadDocument]. + name (:class:`str`): + Required. The name of the document to reload. Format: + ``projects//locations//knowledgeBases//documents/`` + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + gcs_source (:class:`~.gcs.GcsSource`): + The path for a Cloud Storage source + file for reloading document content. If + not provided, the Document's existing + source will be reloaded. + This corresponds to the ``gcs_source`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.document.Document``: A knowledge document to + be used by a + [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases.documents`` + resource is deprecated; only use + ``projects.knowledgeBases.documents``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name, gcs_source]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = document.ReloadDocumentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + if gcs_source is not None: + request.gcs_source = gcs_source + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.reload_document, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + document.Document, + metadata_type=document.KnowledgeOperationMetadata, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("DocumentsAsyncClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/documents/client.py b/google/cloud/dialogflow_v2beta1/services/documents/client.py new file mode 100644 index 000000000..d8a5e0e11 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/documents/client.py @@ -0,0 +1,943 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2beta1.services.documents import pagers +from google.cloud.dialogflow_v2beta1.types import document +from google.cloud.dialogflow_v2beta1.types import document as gcd_document +from google.cloud.dialogflow_v2beta1.types import gcs +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + +from .transports.base import DocumentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import DocumentsGrpcTransport +from .transports.grpc_asyncio import DocumentsGrpcAsyncIOTransport + + +class DocumentsClientMeta(type): + """Metaclass for the Documents client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[DocumentsTransport]] + _transport_registry["grpc"] = DocumentsGrpcTransport + _transport_registry["grpc_asyncio"] = DocumentsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[DocumentsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class DocumentsClient(metaclass=DocumentsClientMeta): + """Service for managing knowledge + [Documents][google.cloud.dialogflow.v2beta1.Document]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> DocumentsTransport: + """Return the transport used by the client instance. + + Returns: + DocumentsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def document_path(project: str, knowledge_base: str, document: str,) -> str: + """Return a fully-qualified document string.""" + return "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}".format( + project=project, knowledge_base=knowledge_base, document=document, + ) + + @staticmethod + def parse_document_path(path: str) -> Dict[str, str]: + """Parse a document path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/knowledgeBases/(?P.+?)/documents/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, DocumentsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the documents client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.DocumentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, DocumentsTransport): + # transport is a DocumentsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_documents( + self, + request: document.ListDocumentsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListDocumentsPager: + r"""Returns the list of all documents of the knowledge base. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.document.ListDocumentsRequest`): + The request object. Request message for + [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. + parent (:class:`str`): + Required. The knowledge base to list all documents for. + Format: + ``projects//locations//knowledgeBases/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListDocumentsPager: + Response message for + [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a document.ListDocumentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, document.ListDocumentsRequest): + request = document.ListDocumentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_documents] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.ListDocumentsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def get_document( + self, + request: document.GetDocumentRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> document.Document: + r"""Retrieves the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.document.GetDocumentRequest`): + The request object. Request message for + [Documents.GetDocument][google.cloud.dialogflow.v2beta1.Documents.GetDocument]. + name (:class:`str`): + Required. The name of the document to retrieve. Format + ``projects//locations//knowledgeBases//documents/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.document.Document: + A knowledge document to be used by a + [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases.documents`` + resource is deprecated; only use + ``projects.knowledgeBases.documents``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a document.GetDocumentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, document.GetDocumentRequest): + request = document.GetDocumentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_document] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_document( + self, + request: gcd_document.CreateDocumentRequest = None, + *, + parent: str = None, + document: gcd_document.Document = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates a new document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.gcd_document.CreateDocumentRequest`): + The request object. Request message for + [Documents.CreateDocument][google.cloud.dialogflow.v2beta1.Documents.CreateDocument]. + parent (:class:`str`): + Required. The knowledge base to create a document for. + Format: + ``projects//locations//knowledgeBases/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + document (:class:`~.gcd_document.Document`): + Required. The document to create. + This corresponds to the ``document`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.gcd_document.Document``: A knowledge document + to be used by a + [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases.documents`` + resource is deprecated; only use + ``projects.knowledgeBases.documents``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, document]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_document.CreateDocumentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_document.CreateDocumentRequest): + request = gcd_document.CreateDocumentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if document is not None: + request.document = document + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_document] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + gcd_document.Document, + metadata_type=gcd_document.KnowledgeOperationMetadata, + ) + + # Done; return the response. + return response + + def delete_document( + self, + request: document.DeleteDocumentRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.document.DeleteDocumentRequest`): + The request object. Request message for + [Documents.DeleteDocument][google.cloud.dialogflow.v2beta1.Documents.DeleteDocument]. + name (:class:`str`): + Required. The name of the document to delete. Format: + ``projects//locations//knowledgeBases//documents/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a document.DeleteDocumentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, document.DeleteDocumentRequest): + request = document.DeleteDocumentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_document] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=document.KnowledgeOperationMetadata, + ) + + # Done; return the response. + return response + + def update_document( + self, + request: gcd_document.UpdateDocumentRequest = None, + *, + document: gcd_document.Document = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.gcd_document.UpdateDocumentRequest`): + The request object. Request message for + [Documents.UpdateDocument][google.cloud.dialogflow.v2beta1.Documents.UpdateDocument]. + document (:class:`~.gcd_document.Document`): + Required. The document to update. + This corresponds to the ``document`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. Not specified means ``update all``. Currently, + only ``display_name`` can be updated, an InvalidArgument + will be returned for attempting to update other fields. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.gcd_document.Document``: A knowledge document + to be used by a + [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases.documents`` + resource is deprecated; only use + ``projects.knowledgeBases.documents``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([document, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_document.UpdateDocumentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_document.UpdateDocumentRequest): + request = gcd_document.UpdateDocumentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if document is not None: + request.document = document + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_document] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("document.name", request.document.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + gcd_document.Document, + metadata_type=gcd_document.KnowledgeOperationMetadata, + ) + + # Done; return the response. + return response + + def reload_document( + self, + request: document.ReloadDocumentRequest = None, + *, + name: str = None, + gcs_source: gcs.GcsSource = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Reloads the specified document from its specified source, + content_uri or content. The previously loaded content of the + document will be deleted. Note: Even when the content of the + document has not changed, there still may be side effects + because of internal implementation changes. Note: If the + document source is Google Cloud Storage URI, its metadata will + be replaced with the custom metadata from Google Cloud Storage + if the ``import_gcs_custom_metadata`` field is set to true in + the request. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Args: + request (:class:`~.document.ReloadDocumentRequest`): + The request object. Request message for + [Documents.ReloadDocument][google.cloud.dialogflow.v2beta1.Documents.ReloadDocument]. + name (:class:`str`): + Required. The name of the document to reload. Format: + ``projects//locations//knowledgeBases//documents/`` + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + gcs_source (:class:`~.gcs.GcsSource`): + The path for a Cloud Storage source + file for reloading document content. If + not provided, the Document's existing + source will be reloaded. + This corresponds to the ``gcs_source`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.document.Document``: A knowledge document to + be used by a + [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases.documents`` + resource is deprecated; only use + ``projects.knowledgeBases.documents``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name, gcs_source]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a document.ReloadDocumentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, document.ReloadDocumentRequest): + request = document.ReloadDocumentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + if gcs_source is not None: + request.gcs_source = gcs_source + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.reload_document] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + document.Document, + metadata_type=document.KnowledgeOperationMetadata, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("DocumentsClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/documents/pagers.py b/google/cloud/dialogflow_v2beta1/services/documents/pagers.py new file mode 100644 index 000000000..44c0c6500 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/documents/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2beta1.types import document + + +class ListDocumentsPager: + """A pager for iterating through ``list_documents`` requests. + + This class thinly wraps an initial + :class:`~.document.ListDocumentsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``documents`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListDocuments`` requests and continue to iterate + through the ``documents`` field on the + corresponding responses. + + All the usual :class:`~.document.ListDocumentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., document.ListDocumentsResponse], + request: document.ListDocumentsRequest, + response: document.ListDocumentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.document.ListDocumentsRequest`): + The initial request object. + response (:class:`~.document.ListDocumentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = document.ListDocumentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[document.ListDocumentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[document.Document]: + for page in self.pages: + yield from page.documents + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListDocumentsAsyncPager: + """A pager for iterating through ``list_documents`` requests. + + This class thinly wraps an initial + :class:`~.document.ListDocumentsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``documents`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListDocuments`` requests and continue to iterate + through the ``documents`` field on the + corresponding responses. + + All the usual :class:`~.document.ListDocumentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[document.ListDocumentsResponse]], + request: document.ListDocumentsRequest, + response: document.ListDocumentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.document.ListDocumentsRequest`): + The initial request object. + response (:class:`~.document.ListDocumentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = document.ListDocumentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[document.ListDocumentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[document.Document]: + async def async_generator(): + async for page in self.pages: + for response in page.documents: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2beta1/services/documents/transports/__init__.py b/google/cloud/dialogflow_v2beta1/services/documents/transports/__init__.py new file mode 100644 index 000000000..e289836e4 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/documents/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import DocumentsTransport +from .grpc import DocumentsGrpcTransport +from .grpc_asyncio import DocumentsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[DocumentsTransport]] +_transport_registry["grpc"] = DocumentsGrpcTransport +_transport_registry["grpc_asyncio"] = DocumentsGrpcAsyncIOTransport + + +__all__ = ( + "DocumentsTransport", + "DocumentsGrpcTransport", + "DocumentsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2beta1/services/documents/transports/base.py b/google/cloud/dialogflow_v2beta1/services/documents/transports/base.py new file mode 100644 index 000000000..763cceb25 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/documents/transports/base.py @@ -0,0 +1,198 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2beta1.types import document +from google.cloud.dialogflow_v2beta1.types import document as gcd_document +from google.longrunning import operations_pb2 as operations # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class DocumentsTransport(abc.ABC): + """Abstract transport class for Documents.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_documents: gapic_v1.method.wrap_method( + self.list_documents, default_timeout=None, client_info=client_info, + ), + self.get_document: gapic_v1.method.wrap_method( + self.get_document, default_timeout=None, client_info=client_info, + ), + self.create_document: gapic_v1.method.wrap_method( + self.create_document, default_timeout=None, client_info=client_info, + ), + self.delete_document: gapic_v1.method.wrap_method( + self.delete_document, default_timeout=None, client_info=client_info, + ), + self.update_document: gapic_v1.method.wrap_method( + self.update_document, default_timeout=None, client_info=client_info, + ), + self.reload_document: gapic_v1.method.wrap_method( + self.reload_document, default_timeout=None, client_info=client_info, + ), + } + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def list_documents( + self, + ) -> typing.Callable[ + [document.ListDocumentsRequest], + typing.Union[ + document.ListDocumentsResponse, + typing.Awaitable[document.ListDocumentsResponse], + ], + ]: + raise NotImplementedError() + + @property + def get_document( + self, + ) -> typing.Callable[ + [document.GetDocumentRequest], + typing.Union[document.Document, typing.Awaitable[document.Document]], + ]: + raise NotImplementedError() + + @property + def create_document( + self, + ) -> typing.Callable[ + [gcd_document.CreateDocumentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def delete_document( + self, + ) -> typing.Callable[ + [document.DeleteDocumentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def update_document( + self, + ) -> typing.Callable[ + [gcd_document.UpdateDocumentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def reload_document( + self, + ) -> typing.Callable[ + [document.ReloadDocumentRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + +__all__ = ("DocumentsTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/documents/transports/grpc.py b/google/cloud/dialogflow_v2beta1/services/documents/transports/grpc.py new file mode 100644 index 000000000..acda815f8 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/documents/transports/grpc.py @@ -0,0 +1,435 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2beta1.types import document +from google.cloud.dialogflow_v2beta1.types import document as gcd_document +from google.longrunning import operations_pb2 as operations # type: ignore + +from .base import DocumentsTransport, DEFAULT_CLIENT_INFO + + +class DocumentsGrpcTransport(DocumentsTransport): + """gRPC backend transport for Documents. + + Service for managing knowledge + [Documents][google.cloud.dialogflow.v2beta1.Document]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def list_documents( + self, + ) -> Callable[[document.ListDocumentsRequest], document.ListDocumentsResponse]: + r"""Return a callable for the list documents method over gRPC. + + Returns the list of all documents of the knowledge base. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.ListDocumentsRequest], + ~.ListDocumentsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_documents" not in self._stubs: + self._stubs["list_documents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/ListDocuments", + request_serializer=document.ListDocumentsRequest.serialize, + response_deserializer=document.ListDocumentsResponse.deserialize, + ) + return self._stubs["list_documents"] + + @property + def get_document( + self, + ) -> Callable[[document.GetDocumentRequest], document.Document]: + r"""Return a callable for the get document method over gRPC. + + Retrieves the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.GetDocumentRequest], + ~.Document]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_document" not in self._stubs: + self._stubs["get_document"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/GetDocument", + request_serializer=document.GetDocumentRequest.serialize, + response_deserializer=document.Document.deserialize, + ) + return self._stubs["get_document"] + + @property + def create_document( + self, + ) -> Callable[[gcd_document.CreateDocumentRequest], operations.Operation]: + r"""Return a callable for the create document method over gRPC. + + Creates a new document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.CreateDocumentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_document" not in self._stubs: + self._stubs["create_document"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/CreateDocument", + request_serializer=gcd_document.CreateDocumentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["create_document"] + + @property + def delete_document( + self, + ) -> Callable[[document.DeleteDocumentRequest], operations.Operation]: + r"""Return a callable for the delete document method over gRPC. + + Deletes the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.DeleteDocumentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_document" not in self._stubs: + self._stubs["delete_document"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/DeleteDocument", + request_serializer=document.DeleteDocumentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["delete_document"] + + @property + def update_document( + self, + ) -> Callable[[gcd_document.UpdateDocumentRequest], operations.Operation]: + r"""Return a callable for the update document method over gRPC. + + Updates the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.UpdateDocumentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_document" not in self._stubs: + self._stubs["update_document"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/UpdateDocument", + request_serializer=gcd_document.UpdateDocumentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["update_document"] + + @property + def reload_document( + self, + ) -> Callable[[document.ReloadDocumentRequest], operations.Operation]: + r"""Return a callable for the reload document method over gRPC. + + Reloads the specified document from its specified source, + content_uri or content. The previously loaded content of the + document will be deleted. Note: Even when the content of the + document has not changed, there still may be side effects + because of internal implementation changes. Note: If the + document source is Google Cloud Storage URI, its metadata will + be replaced with the custom metadata from Google Cloud Storage + if the ``import_gcs_custom_metadata`` field is set to true in + the request. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.ReloadDocumentRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "reload_document" not in self._stubs: + self._stubs["reload_document"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/ReloadDocument", + request_serializer=document.ReloadDocumentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["reload_document"] + + +__all__ = ("DocumentsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/documents/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2beta1/services/documents/transports/grpc_asyncio.py new file mode 100644 index 000000000..ebab81bcb --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/documents/transports/grpc_asyncio.py @@ -0,0 +1,445 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import operations_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2beta1.types import document +from google.cloud.dialogflow_v2beta1.types import document as gcd_document +from google.longrunning import operations_pb2 as operations # type: ignore + +from .base import DocumentsTransport, DEFAULT_CLIENT_INFO +from .grpc import DocumentsGrpcTransport + + +class DocumentsGrpcAsyncIOTransport(DocumentsTransport): + """gRPC AsyncIO backend transport for Documents. + + Service for managing knowledge + [Documents][google.cloud.dialogflow.v2beta1.Document]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def list_documents( + self, + ) -> Callable[ + [document.ListDocumentsRequest], Awaitable[document.ListDocumentsResponse] + ]: + r"""Return a callable for the list documents method over gRPC. + + Returns the list of all documents of the knowledge base. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.ListDocumentsRequest], + Awaitable[~.ListDocumentsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_documents" not in self._stubs: + self._stubs["list_documents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/ListDocuments", + request_serializer=document.ListDocumentsRequest.serialize, + response_deserializer=document.ListDocumentsResponse.deserialize, + ) + return self._stubs["list_documents"] + + @property + def get_document( + self, + ) -> Callable[[document.GetDocumentRequest], Awaitable[document.Document]]: + r"""Return a callable for the get document method over gRPC. + + Retrieves the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.GetDocumentRequest], + Awaitable[~.Document]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_document" not in self._stubs: + self._stubs["get_document"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/GetDocument", + request_serializer=document.GetDocumentRequest.serialize, + response_deserializer=document.Document.deserialize, + ) + return self._stubs["get_document"] + + @property + def create_document( + self, + ) -> Callable[ + [gcd_document.CreateDocumentRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the create document method over gRPC. + + Creates a new document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.CreateDocumentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_document" not in self._stubs: + self._stubs["create_document"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/CreateDocument", + request_serializer=gcd_document.CreateDocumentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["create_document"] + + @property + def delete_document( + self, + ) -> Callable[[document.DeleteDocumentRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the delete document method over gRPC. + + Deletes the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.DeleteDocumentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_document" not in self._stubs: + self._stubs["delete_document"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/DeleteDocument", + request_serializer=document.DeleteDocumentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["delete_document"] + + @property + def update_document( + self, + ) -> Callable[ + [gcd_document.UpdateDocumentRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the update document method over gRPC. + + Updates the specified document. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.UpdateDocumentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_document" not in self._stubs: + self._stubs["update_document"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/UpdateDocument", + request_serializer=gcd_document.UpdateDocumentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["update_document"] + + @property + def reload_document( + self, + ) -> Callable[[document.ReloadDocumentRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the reload document method over gRPC. + + Reloads the specified document from its specified source, + content_uri or content. The previously loaded content of the + document will be deleted. Note: Even when the content of the + document has not changed, there still may be side effects + because of internal implementation changes. Note: If the + document source is Google Cloud Storage URI, its metadata will + be replaced with the custom metadata from Google Cloud Storage + if the ``import_gcs_custom_metadata`` field is set to true in + the request. + + Note: The ``projects.agent.knowledgeBases.documents`` resource + is deprecated; only use ``projects.knowledgeBases.documents``. + + Returns: + Callable[[~.ReloadDocumentRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "reload_document" not in self._stubs: + self._stubs["reload_document"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Documents/ReloadDocument", + request_serializer=document.ReloadDocumentRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["reload_document"] + + +__all__ = ("DocumentsGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/entity_types/__init__.py b/google/cloud/dialogflow_v2beta1/services/entity_types/__init__.py new file mode 100644 index 000000000..f52849c66 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/entity_types/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import EntityTypesClient +from .async_client import EntityTypesAsyncClient + +__all__ = ( + "EntityTypesClient", + "EntityTypesAsyncClient", +) diff --git a/google/cloud/dialogflow_v2beta1/services/entity_types/async_client.py b/google/cloud/dialogflow_v2beta1/services/entity_types/async_client.py new file mode 100644 index 000000000..1322a0a25 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/entity_types/async_client.py @@ -0,0 +1,1183 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2beta1.services.entity_types import pagers +from google.cloud.dialogflow_v2beta1.types import entity_type +from google.cloud.dialogflow_v2beta1.types import entity_type as gcd_entity_type +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import EntityTypesTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import EntityTypesGrpcAsyncIOTransport +from .client import EntityTypesClient + + +class EntityTypesAsyncClient: + """Service for managing + [EntityTypes][google.cloud.dialogflow.v2beta1.EntityType]. + """ + + _client: EntityTypesClient + + DEFAULT_ENDPOINT = EntityTypesClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = EntityTypesClient.DEFAULT_MTLS_ENDPOINT + + entity_type_path = staticmethod(EntityTypesClient.entity_type_path) + parse_entity_type_path = staticmethod(EntityTypesClient.parse_entity_type_path) + + common_billing_account_path = staticmethod( + EntityTypesClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + EntityTypesClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(EntityTypesClient.common_folder_path) + parse_common_folder_path = staticmethod(EntityTypesClient.parse_common_folder_path) + + common_organization_path = staticmethod(EntityTypesClient.common_organization_path) + parse_common_organization_path = staticmethod( + EntityTypesClient.parse_common_organization_path + ) + + common_project_path = staticmethod(EntityTypesClient.common_project_path) + parse_common_project_path = staticmethod( + EntityTypesClient.parse_common_project_path + ) + + common_location_path = staticmethod(EntityTypesClient.common_location_path) + parse_common_location_path = staticmethod( + EntityTypesClient.parse_common_location_path + ) + + from_service_account_file = EntityTypesClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> EntityTypesTransport: + """Return the transport used by the client instance. + + Returns: + EntityTypesTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(EntityTypesClient).get_transport_class, type(EntityTypesClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, EntityTypesTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the entity types client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.EntityTypesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = EntityTypesClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_entity_types( + self, + request: entity_type.ListEntityTypesRequest = None, + *, + parent: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEntityTypesAsyncPager: + r"""Returns the list of all entity types in the specified + agent. + + Args: + request (:class:`~.entity_type.ListEntityTypesRequest`): + The request object. The request message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. + parent (:class:`str`): + Required. The agent to list all entity types from. + Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListEntityTypesAsyncPager: + The response message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.ListEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_entity_types, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def get_entity_type( + self, + request: entity_type.GetEntityTypeRequest = None, + *, + name: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> entity_type.EntityType: + r"""Retrieves the specified entity type. + + Args: + request (:class:`~.entity_type.GetEntityTypeRequest`): + The request object. The request message for + [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType]. + name (:class:`str`): + Required. The name of the entity type. Supported + formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.GetEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_entity_type( + self, + request: gcd_entity_type.CreateEntityTypeRequest = None, + *, + parent: str = None, + entity_type: gcd_entity_type.EntityType = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_entity_type.EntityType: + r"""Creates an entity type in the specified agent. + + Args: + request (:class:`~.gcd_entity_type.CreateEntityTypeRequest`): + The request object. The request message for + [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType]. + parent (:class:`str`): + Required. The agent to create a entity type for. + Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_type (:class:`~.gcd_entity_type.EntityType`): + Required. The entity type to create. + This corresponds to the ``entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_type, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_entity_type.CreateEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if entity_type is not None: + request.entity_type = entity_type + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def update_entity_type( + self, + request: gcd_entity_type.UpdateEntityTypeRequest = None, + *, + entity_type: gcd_entity_type.EntityType = None, + language_code: str = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_entity_type.EntityType: + r"""Updates the specified entity type. + + Args: + request (:class:`~.gcd_entity_type.UpdateEntityTypeRequest`): + The request object. The request message for + [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType]. + entity_type (:class:`~.gcd_entity_type.EntityType`): + Required. The entity type to update. + This corresponds to the ``entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([entity_type, language_code, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_entity_type.UpdateEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if entity_type is not None: + request.entity_type = entity_type + if language_code is not None: + request.language_code = language_code + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("entity_type.name", request.entity_type.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_entity_type( + self, + request: entity_type.DeleteEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified entity type. + + Args: + request (:class:`~.entity_type.DeleteEntityTypeRequest`): + The request object. The request message for + [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType]. + name (:class:`str`): + Required. The name of the entity type to delete. + Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.DeleteEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def batch_update_entity_types( + self, + request: entity_type.BatchUpdateEntityTypesRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates/Creates multiple entity types in the specified agent. + Operation + + Args: + request (:class:`~.entity_type.BatchUpdateEntityTypesRequest`): + The request object. The request message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.entity_type.BatchUpdateEntityTypesResponse``: + The response message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. + + """ + # Create or coerce a protobuf request object. + + request = entity_type.BatchUpdateEntityTypesRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_update_entity_types, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + entity_type.BatchUpdateEntityTypesResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def batch_delete_entity_types( + self, + request: entity_type.BatchDeleteEntityTypesRequest = None, + *, + parent: str = None, + entity_type_names: Sequence[str] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes entity types in the specified agent. Operation + + + Args: + request (:class:`~.entity_type.BatchDeleteEntityTypesRequest`): + The request object. The request message for + [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes]. + parent (:class:`str`): + Required. The name of the agent to delete all entities + types for. Supported formats: + + - ``projects//agent``, + - ``projects//locations//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_type_names (:class:`Sequence[str]`): + Required. The names entity types to delete. All names + must point to the same agent as ``parent``. + This corresponds to the ``entity_type_names`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_type_names]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.BatchDeleteEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + if entity_type_names: + request.entity_type_names.extend(entity_type_names) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_delete_entity_types, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def batch_create_entities( + self, + request: entity_type.BatchCreateEntitiesRequest = None, + *, + parent: str = None, + entities: Sequence[entity_type.EntityType.Entity] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates multiple new entities in the specified entity type. + + Operation + + Args: + request (:class:`~.entity_type.BatchCreateEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. + parent (:class:`str`): + Required. The name of the entity type to create entities + in. Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entities (:class:`Sequence[~.entity_type.EntityType.Entity]`): + Required. The entities to create. + This corresponds to the ``entities`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entities, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.BatchCreateEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entities: + request.entities.extend(entities) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_create_entities, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def batch_update_entities( + self, + request: entity_type.BatchUpdateEntitiesRequest = None, + *, + parent: str = None, + entities: Sequence[entity_type.EntityType.Entity] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates or creates multiple entities in the specified entity + type. This method does not affect entities in the entity type + that aren't explicitly specified in the request. + + Operation + + Args: + request (:class:`~.entity_type.BatchUpdateEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities]. + parent (:class:`str`): + Required. The name of the entity type to update or + create entities in. Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entities (:class:`Sequence[~.entity_type.EntityType.Entity]`): + Required. The entities to update or + create. + This corresponds to the ``entities`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entities, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.BatchUpdateEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entities: + request.entities.extend(entities) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_update_entities, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def batch_delete_entities( + self, + request: entity_type.BatchDeleteEntitiesRequest = None, + *, + parent: str = None, + entity_values: Sequence[str] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes entities in the specified entity type. + + Operation + + Args: + request (:class:`~.entity_type.BatchDeleteEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities]. + parent (:class:`str`): + Required. The name of the entity type to delete entries + for. Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_values (:class:`Sequence[str]`): + Required. The reference ``values`` of the entities to + delete. Note that these are not fully-qualified names, + i.e. they don't start with ``projects/``. + This corresponds to the ``entity_values`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_values, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = entity_type.BatchDeleteEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entity_values: + request.entity_values.extend(entity_values) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_delete_entities, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("EntityTypesAsyncClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/entity_types/client.py b/google/cloud/dialogflow_v2beta1/services/entity_types/client.py new file mode 100644 index 000000000..f5c4890e7 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/entity_types/client.py @@ -0,0 +1,1389 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2beta1.services.entity_types import pagers +from google.cloud.dialogflow_v2beta1.types import entity_type +from google.cloud.dialogflow_v2beta1.types import entity_type as gcd_entity_type +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import EntityTypesTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import EntityTypesGrpcTransport +from .transports.grpc_asyncio import EntityTypesGrpcAsyncIOTransport + + +class EntityTypesClientMeta(type): + """Metaclass for the EntityTypes client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[EntityTypesTransport]] + _transport_registry["grpc"] = EntityTypesGrpcTransport + _transport_registry["grpc_asyncio"] = EntityTypesGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[EntityTypesTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class EntityTypesClient(metaclass=EntityTypesClientMeta): + """Service for managing + [EntityTypes][google.cloud.dialogflow.v2beta1.EntityType]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> EntityTypesTransport: + """Return the transport used by the client instance. + + Returns: + EntityTypesTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def entity_type_path(project: str, entity_type: str,) -> str: + """Return a fully-qualified entity_type string.""" + return "projects/{project}/agent/entityTypes/{entity_type}".format( + project=project, entity_type=entity_type, + ) + + @staticmethod + def parse_entity_type_path(path: str) -> Dict[str, str]: + """Parse a entity_type path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/entityTypes/(?P.+?)$", path + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, EntityTypesTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the entity types client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.EntityTypesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, EntityTypesTransport): + # transport is a EntityTypesTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_entity_types( + self, + request: entity_type.ListEntityTypesRequest = None, + *, + parent: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEntityTypesPager: + r"""Returns the list of all entity types in the specified + agent. + + Args: + request (:class:`~.entity_type.ListEntityTypesRequest`): + The request object. The request message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. + parent (:class:`str`): + Required. The agent to list all entity types from. + Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListEntityTypesPager: + The response message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.ListEntityTypesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.ListEntityTypesRequest): + request = entity_type.ListEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_entity_types] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def get_entity_type( + self, + request: entity_type.GetEntityTypeRequest = None, + *, + name: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> entity_type.EntityType: + r"""Retrieves the specified entity type. + + Args: + request (:class:`~.entity_type.GetEntityTypeRequest`): + The request object. The request message for + [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType]. + name (:class:`str`): + Required. The name of the entity type. Supported + formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.GetEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.GetEntityTypeRequest): + request = entity_type.GetEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_entity_type] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_entity_type( + self, + request: gcd_entity_type.CreateEntityTypeRequest = None, + *, + parent: str = None, + entity_type: gcd_entity_type.EntityType = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_entity_type.EntityType: + r"""Creates an entity type in the specified agent. + + Args: + request (:class:`~.gcd_entity_type.CreateEntityTypeRequest`): + The request object. The request message for + [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType]. + parent (:class:`str`): + Required. The agent to create a entity type for. + Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_type (:class:`~.gcd_entity_type.EntityType`): + Required. The entity type to create. + This corresponds to the ``entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_type, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_entity_type.CreateEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_entity_type.CreateEntityTypeRequest): + request = gcd_entity_type.CreateEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if entity_type is not None: + request.entity_type = entity_type + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_entity_type] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def update_entity_type( + self, + request: gcd_entity_type.UpdateEntityTypeRequest = None, + *, + entity_type: gcd_entity_type.EntityType = None, + language_code: str = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_entity_type.EntityType: + r"""Updates the specified entity type. + + Args: + request (:class:`~.gcd_entity_type.UpdateEntityTypeRequest`): + The request object. The request message for + [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType]. + entity_type (:class:`~.gcd_entity_type.EntityType`): + Required. The entity type to update. + This corresponds to the ``entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_entity_type.EntityType: + Each intent parameter has a type, called the entity + type, which dictates exactly how data from an end-user + expression is extracted. + + Dialogflow provides predefined system entities that can + match many common types of data. For example, there are + system entities for matching dates, times, colors, email + addresses, and so on. You can also create your own + custom entities for matching custom data. For example, + you could define a vegetable entity that can match the + types of vegetables available for purchase with a + grocery store agent. + + For more information, see the `Entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([entity_type, language_code, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_entity_type.UpdateEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_entity_type.UpdateEntityTypeRequest): + request = gcd_entity_type.UpdateEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if entity_type is not None: + request.entity_type = entity_type + if language_code is not None: + request.language_code = language_code + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_entity_type] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("entity_type.name", request.entity_type.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_entity_type( + self, + request: entity_type.DeleteEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified entity type. + + Args: + request (:class:`~.entity_type.DeleteEntityTypeRequest`): + The request object. The request message for + [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType]. + name (:class:`str`): + Required. The name of the entity type to delete. + Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.DeleteEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.DeleteEntityTypeRequest): + request = entity_type.DeleteEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_entity_type] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def batch_update_entity_types( + self, + request: entity_type.BatchUpdateEntityTypesRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates/Creates multiple entity types in the specified agent. + Operation + + Args: + request (:class:`~.entity_type.BatchUpdateEntityTypesRequest`): + The request object. The request message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.entity_type.BatchUpdateEntityTypesResponse``: + The response message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.BatchUpdateEntityTypesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.BatchUpdateEntityTypesRequest): + request = entity_type.BatchUpdateEntityTypesRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.batch_update_entity_types + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + entity_type.BatchUpdateEntityTypesResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def batch_delete_entity_types( + self, + request: entity_type.BatchDeleteEntityTypesRequest = None, + *, + parent: str = None, + entity_type_names: Sequence[str] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes entity types in the specified agent. Operation + + + Args: + request (:class:`~.entity_type.BatchDeleteEntityTypesRequest`): + The request object. The request message for + [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes]. + parent (:class:`str`): + Required. The name of the agent to delete all entities + types for. Supported formats: + + - ``projects//agent``, + - ``projects//locations//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_type_names (:class:`Sequence[str]`): + Required. The names entity types to delete. All names + must point to the same agent as ``parent``. + This corresponds to the ``entity_type_names`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_type_names]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.BatchDeleteEntityTypesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.BatchDeleteEntityTypesRequest): + request = entity_type.BatchDeleteEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + if entity_type_names: + request.entity_type_names.extend(entity_type_names) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.batch_delete_entity_types + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def batch_create_entities( + self, + request: entity_type.BatchCreateEntitiesRequest = None, + *, + parent: str = None, + entities: Sequence[entity_type.EntityType.Entity] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates multiple new entities in the specified entity type. + + Operation + + Args: + request (:class:`~.entity_type.BatchCreateEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. + parent (:class:`str`): + Required. The name of the entity type to create entities + in. Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entities (:class:`Sequence[~.entity_type.EntityType.Entity]`): + Required. The entities to create. + This corresponds to the ``entities`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entities, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.BatchCreateEntitiesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.BatchCreateEntitiesRequest): + request = entity_type.BatchCreateEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entities: + request.entities.extend(entities) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_create_entities] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def batch_update_entities( + self, + request: entity_type.BatchUpdateEntitiesRequest = None, + *, + parent: str = None, + entities: Sequence[entity_type.EntityType.Entity] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates or creates multiple entities in the specified entity + type. This method does not affect entities in the entity type + that aren't explicitly specified in the request. + + Operation + + Args: + request (:class:`~.entity_type.BatchUpdateEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities]. + parent (:class:`str`): + Required. The name of the entity type to update or + create entities in. Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entities (:class:`Sequence[~.entity_type.EntityType.Entity]`): + Required. The entities to update or + create. + This corresponds to the ``entities`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entities, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.BatchUpdateEntitiesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.BatchUpdateEntitiesRequest): + request = entity_type.BatchUpdateEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entities: + request.entities.extend(entities) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_update_entities] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def batch_delete_entities( + self, + request: entity_type.BatchDeleteEntitiesRequest = None, + *, + parent: str = None, + entity_values: Sequence[str] = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes entities in the specified entity type. + + Operation + + Args: + request (:class:`~.entity_type.BatchDeleteEntitiesRequest`): + The request object. The request message for + [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities]. + parent (:class:`str`): + Required. The name of the entity type to delete entries + for. Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + entity_values (:class:`Sequence[str]`): + Required. The reference ``values`` of the entities to + delete. Note that these are not fully-qualified names, + i.e. they don't start with ``projects/``. + This corresponds to the ``entity_values`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, entity_values, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a entity_type.BatchDeleteEntitiesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, entity_type.BatchDeleteEntitiesRequest): + request = entity_type.BatchDeleteEntitiesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + if entity_values: + request.entity_values.extend(entity_values) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_delete_entities] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("EntityTypesClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/entity_types/pagers.py b/google/cloud/dialogflow_v2beta1/services/entity_types/pagers.py new file mode 100644 index 000000000..0efe08d05 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/entity_types/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2beta1.types import entity_type + + +class ListEntityTypesPager: + """A pager for iterating through ``list_entity_types`` requests. + + This class thinly wraps an initial + :class:`~.entity_type.ListEntityTypesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``entity_types`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListEntityTypes`` requests and continue to iterate + through the ``entity_types`` field on the + corresponding responses. + + All the usual :class:`~.entity_type.ListEntityTypesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., entity_type.ListEntityTypesResponse], + request: entity_type.ListEntityTypesRequest, + response: entity_type.ListEntityTypesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.entity_type.ListEntityTypesRequest`): + The initial request object. + response (:class:`~.entity_type.ListEntityTypesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = entity_type.ListEntityTypesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[entity_type.ListEntityTypesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[entity_type.EntityType]: + for page in self.pages: + yield from page.entity_types + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListEntityTypesAsyncPager: + """A pager for iterating through ``list_entity_types`` requests. + + This class thinly wraps an initial + :class:`~.entity_type.ListEntityTypesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``entity_types`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListEntityTypes`` requests and continue to iterate + through the ``entity_types`` field on the + corresponding responses. + + All the usual :class:`~.entity_type.ListEntityTypesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[entity_type.ListEntityTypesResponse]], + request: entity_type.ListEntityTypesRequest, + response: entity_type.ListEntityTypesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.entity_type.ListEntityTypesRequest`): + The initial request object. + response (:class:`~.entity_type.ListEntityTypesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = entity_type.ListEntityTypesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[entity_type.ListEntityTypesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[entity_type.EntityType]: + async def async_generator(): + async for page in self.pages: + for response in page.entity_types: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2beta1/services/entity_types/transports/__init__.py b/google/cloud/dialogflow_v2beta1/services/entity_types/transports/__init__.py new file mode 100644 index 000000000..bd6250cb0 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/entity_types/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import EntityTypesTransport +from .grpc import EntityTypesGrpcTransport +from .grpc_asyncio import EntityTypesGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[EntityTypesTransport]] +_transport_registry["grpc"] = EntityTypesGrpcTransport +_transport_registry["grpc_asyncio"] = EntityTypesGrpcAsyncIOTransport + + +__all__ = ( + "EntityTypesTransport", + "EntityTypesGrpcTransport", + "EntityTypesGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2beta1/services/entity_types/transports/base.py b/google/cloud/dialogflow_v2beta1/services/entity_types/transports/base.py new file mode 100644 index 000000000..c04f42d99 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/entity_types/transports/base.py @@ -0,0 +1,261 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2beta1.types import entity_type +from google.cloud.dialogflow_v2beta1.types import entity_type as gcd_entity_type +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class EntityTypesTransport(abc.ABC): + """Abstract transport class for EntityTypes.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + 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.get_entity_type: gapic_v1.method.wrap_method( + 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.update_entity_type: gapic_v1.method.wrap_method( + 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.batch_update_entity_types: gapic_v1.method.wrap_method( + self.batch_update_entity_types, + default_timeout=None, + client_info=client_info, + ), + self.batch_delete_entity_types: gapic_v1.method.wrap_method( + self.batch_delete_entity_types, + default_timeout=None, + client_info=client_info, + ), + self.batch_create_entities: gapic_v1.method.wrap_method( + self.batch_create_entities, + default_timeout=None, + client_info=client_info, + ), + self.batch_update_entities: gapic_v1.method.wrap_method( + self.batch_update_entities, + default_timeout=None, + client_info=client_info, + ), + self.batch_delete_entities: gapic_v1.method.wrap_method( + self.batch_delete_entities, + default_timeout=None, + client_info=client_info, + ), + } + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def list_entity_types( + self, + ) -> typing.Callable[ + [entity_type.ListEntityTypesRequest], + typing.Union[ + entity_type.ListEntityTypesResponse, + typing.Awaitable[entity_type.ListEntityTypesResponse], + ], + ]: + raise NotImplementedError() + + @property + def get_entity_type( + self, + ) -> typing.Callable[ + [entity_type.GetEntityTypeRequest], + typing.Union[entity_type.EntityType, typing.Awaitable[entity_type.EntityType]], + ]: + raise NotImplementedError() + + @property + def create_entity_type( + self, + ) -> typing.Callable[ + [gcd_entity_type.CreateEntityTypeRequest], + typing.Union[ + gcd_entity_type.EntityType, typing.Awaitable[gcd_entity_type.EntityType] + ], + ]: + raise NotImplementedError() + + @property + def update_entity_type( + self, + ) -> typing.Callable[ + [gcd_entity_type.UpdateEntityTypeRequest], + typing.Union[ + gcd_entity_type.EntityType, typing.Awaitable[gcd_entity_type.EntityType] + ], + ]: + raise NotImplementedError() + + @property + def delete_entity_type( + self, + ) -> typing.Callable[ + [entity_type.DeleteEntityTypeRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def batch_update_entity_types( + self, + ) -> typing.Callable[ + [entity_type.BatchUpdateEntityTypesRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def batch_delete_entity_types( + self, + ) -> typing.Callable[ + [entity_type.BatchDeleteEntityTypesRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def batch_create_entities( + self, + ) -> typing.Callable[ + [entity_type.BatchCreateEntitiesRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def batch_update_entities( + self, + ) -> typing.Callable[ + [entity_type.BatchUpdateEntitiesRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def batch_delete_entities( + self, + ) -> typing.Callable[ + [entity_type.BatchDeleteEntitiesRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + +__all__ = ("EntityTypesTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/entity_types/transports/grpc.py b/google/cloud/dialogflow_v2beta1/services/entity_types/transports/grpc.py new file mode 100644 index 000000000..d2e6c2271 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/entity_types/transports/grpc.py @@ -0,0 +1,535 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2beta1.types import entity_type +from google.cloud.dialogflow_v2beta1.types import entity_type as gcd_entity_type +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import EntityTypesTransport, DEFAULT_CLIENT_INFO + + +class EntityTypesGrpcTransport(EntityTypesTransport): + """gRPC backend transport for EntityTypes. + + Service for managing + [EntityTypes][google.cloud.dialogflow.v2beta1.EntityType]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def list_entity_types( + self, + ) -> Callable[ + [entity_type.ListEntityTypesRequest], entity_type.ListEntityTypesResponse + ]: + r"""Return a callable for the list entity types method over gRPC. + + Returns the list of all entity types in the specified + agent. + + Returns: + Callable[[~.ListEntityTypesRequest], + ~.ListEntityTypesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_entity_types" not in self._stubs: + self._stubs["list_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/ListEntityTypes", + request_serializer=entity_type.ListEntityTypesRequest.serialize, + response_deserializer=entity_type.ListEntityTypesResponse.deserialize, + ) + return self._stubs["list_entity_types"] + + @property + def get_entity_type( + self, + ) -> Callable[[entity_type.GetEntityTypeRequest], entity_type.EntityType]: + r"""Return a callable for the get entity type method over gRPC. + + Retrieves the specified entity type. + + Returns: + Callable[[~.GetEntityTypeRequest], + ~.EntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_entity_type" not in self._stubs: + self._stubs["get_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/GetEntityType", + request_serializer=entity_type.GetEntityTypeRequest.serialize, + response_deserializer=entity_type.EntityType.deserialize, + ) + return self._stubs["get_entity_type"] + + @property + def create_entity_type( + self, + ) -> Callable[ + [gcd_entity_type.CreateEntityTypeRequest], gcd_entity_type.EntityType + ]: + r"""Return a callable for the create entity type method over gRPC. + + Creates an entity type in the specified agent. + + Returns: + Callable[[~.CreateEntityTypeRequest], + ~.EntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_entity_type" not in self._stubs: + self._stubs["create_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/CreateEntityType", + request_serializer=gcd_entity_type.CreateEntityTypeRequest.serialize, + response_deserializer=gcd_entity_type.EntityType.deserialize, + ) + return self._stubs["create_entity_type"] + + @property + def update_entity_type( + self, + ) -> Callable[ + [gcd_entity_type.UpdateEntityTypeRequest], gcd_entity_type.EntityType + ]: + r"""Return a callable for the update entity type method over gRPC. + + Updates the specified entity type. + + Returns: + Callable[[~.UpdateEntityTypeRequest], + ~.EntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_entity_type" not in self._stubs: + self._stubs["update_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/UpdateEntityType", + request_serializer=gcd_entity_type.UpdateEntityTypeRequest.serialize, + response_deserializer=gcd_entity_type.EntityType.deserialize, + ) + return self._stubs["update_entity_type"] + + @property + def delete_entity_type( + self, + ) -> Callable[[entity_type.DeleteEntityTypeRequest], empty.Empty]: + r"""Return a callable for the delete entity type method over gRPC. + + Deletes the specified entity type. + + Returns: + Callable[[~.DeleteEntityTypeRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_entity_type" not in self._stubs: + self._stubs["delete_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/DeleteEntityType", + request_serializer=entity_type.DeleteEntityTypeRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_entity_type"] + + @property + def batch_update_entity_types( + self, + ) -> Callable[[entity_type.BatchUpdateEntityTypesRequest], operations.Operation]: + r"""Return a callable for the batch update entity types method over gRPC. + + Updates/Creates multiple entity types in the specified agent. + Operation + + Returns: + Callable[[~.BatchUpdateEntityTypesRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_entity_types" not in self._stubs: + self._stubs["batch_update_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchUpdateEntityTypes", + request_serializer=entity_type.BatchUpdateEntityTypesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_entity_types"] + + @property + def batch_delete_entity_types( + self, + ) -> Callable[[entity_type.BatchDeleteEntityTypesRequest], operations.Operation]: + r"""Return a callable for the batch delete entity types method over gRPC. + + Deletes entity types in the specified agent. Operation + + + Returns: + Callable[[~.BatchDeleteEntityTypesRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_entity_types" not in self._stubs: + self._stubs["batch_delete_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchDeleteEntityTypes", + request_serializer=entity_type.BatchDeleteEntityTypesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_entity_types"] + + @property + def batch_create_entities( + self, + ) -> Callable[[entity_type.BatchCreateEntitiesRequest], operations.Operation]: + r"""Return a callable for the batch create entities method over gRPC. + + Creates multiple new entities in the specified entity type. + + Operation + + Returns: + Callable[[~.BatchCreateEntitiesRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_create_entities" not in self._stubs: + self._stubs["batch_create_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchCreateEntities", + request_serializer=entity_type.BatchCreateEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_create_entities"] + + @property + def batch_update_entities( + self, + ) -> Callable[[entity_type.BatchUpdateEntitiesRequest], operations.Operation]: + r"""Return a callable for the batch update entities method over gRPC. + + Updates or creates multiple entities in the specified entity + type. This method does not affect entities in the entity type + that aren't explicitly specified in the request. + + Operation + + Returns: + Callable[[~.BatchUpdateEntitiesRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_entities" not in self._stubs: + self._stubs["batch_update_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchUpdateEntities", + request_serializer=entity_type.BatchUpdateEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_entities"] + + @property + def batch_delete_entities( + self, + ) -> Callable[[entity_type.BatchDeleteEntitiesRequest], operations.Operation]: + r"""Return a callable for the batch delete entities method over gRPC. + + Deletes entities in the specified entity type. + + Operation + + Returns: + Callable[[~.BatchDeleteEntitiesRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_entities" not in self._stubs: + self._stubs["batch_delete_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchDeleteEntities", + request_serializer=entity_type.BatchDeleteEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_entities"] + + +__all__ = ("EntityTypesGrpcTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/entity_types/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2beta1/services/entity_types/transports/grpc_asyncio.py new file mode 100644 index 000000000..4807a261b --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/entity_types/transports/grpc_asyncio.py @@ -0,0 +1,552 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import operations_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2beta1.types import entity_type +from google.cloud.dialogflow_v2beta1.types import entity_type as gcd_entity_type +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import EntityTypesTransport, DEFAULT_CLIENT_INFO +from .grpc import EntityTypesGrpcTransport + + +class EntityTypesGrpcAsyncIOTransport(EntityTypesTransport): + """gRPC AsyncIO backend transport for EntityTypes. + + Service for managing + [EntityTypes][google.cloud.dialogflow.v2beta1.EntityType]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def list_entity_types( + self, + ) -> Callable[ + [entity_type.ListEntityTypesRequest], + Awaitable[entity_type.ListEntityTypesResponse], + ]: + r"""Return a callable for the list entity types method over gRPC. + + Returns the list of all entity types in the specified + agent. + + Returns: + Callable[[~.ListEntityTypesRequest], + Awaitable[~.ListEntityTypesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_entity_types" not in self._stubs: + self._stubs["list_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/ListEntityTypes", + request_serializer=entity_type.ListEntityTypesRequest.serialize, + response_deserializer=entity_type.ListEntityTypesResponse.deserialize, + ) + return self._stubs["list_entity_types"] + + @property + def get_entity_type( + self, + ) -> Callable[ + [entity_type.GetEntityTypeRequest], Awaitable[entity_type.EntityType] + ]: + r"""Return a callable for the get entity type method over gRPC. + + Retrieves the specified entity type. + + Returns: + Callable[[~.GetEntityTypeRequest], + Awaitable[~.EntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_entity_type" not in self._stubs: + self._stubs["get_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/GetEntityType", + request_serializer=entity_type.GetEntityTypeRequest.serialize, + response_deserializer=entity_type.EntityType.deserialize, + ) + return self._stubs["get_entity_type"] + + @property + def create_entity_type( + self, + ) -> Callable[ + [gcd_entity_type.CreateEntityTypeRequest], Awaitable[gcd_entity_type.EntityType] + ]: + r"""Return a callable for the create entity type method over gRPC. + + Creates an entity type in the specified agent. + + Returns: + Callable[[~.CreateEntityTypeRequest], + Awaitable[~.EntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_entity_type" not in self._stubs: + self._stubs["create_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/CreateEntityType", + request_serializer=gcd_entity_type.CreateEntityTypeRequest.serialize, + response_deserializer=gcd_entity_type.EntityType.deserialize, + ) + return self._stubs["create_entity_type"] + + @property + def update_entity_type( + self, + ) -> Callable[ + [gcd_entity_type.UpdateEntityTypeRequest], Awaitable[gcd_entity_type.EntityType] + ]: + r"""Return a callable for the update entity type method over gRPC. + + Updates the specified entity type. + + Returns: + Callable[[~.UpdateEntityTypeRequest], + Awaitable[~.EntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_entity_type" not in self._stubs: + self._stubs["update_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/UpdateEntityType", + request_serializer=gcd_entity_type.UpdateEntityTypeRequest.serialize, + response_deserializer=gcd_entity_type.EntityType.deserialize, + ) + return self._stubs["update_entity_type"] + + @property + def delete_entity_type( + self, + ) -> Callable[[entity_type.DeleteEntityTypeRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete entity type method over gRPC. + + Deletes the specified entity type. + + Returns: + Callable[[~.DeleteEntityTypeRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_entity_type" not in self._stubs: + self._stubs["delete_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/DeleteEntityType", + request_serializer=entity_type.DeleteEntityTypeRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_entity_type"] + + @property + def batch_update_entity_types( + self, + ) -> Callable[ + [entity_type.BatchUpdateEntityTypesRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch update entity types method over gRPC. + + Updates/Creates multiple entity types in the specified agent. + Operation + + Returns: + Callable[[~.BatchUpdateEntityTypesRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_entity_types" not in self._stubs: + self._stubs["batch_update_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchUpdateEntityTypes", + request_serializer=entity_type.BatchUpdateEntityTypesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_entity_types"] + + @property + def batch_delete_entity_types( + self, + ) -> Callable[ + [entity_type.BatchDeleteEntityTypesRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch delete entity types method over gRPC. + + Deletes entity types in the specified agent. Operation + + + Returns: + Callable[[~.BatchDeleteEntityTypesRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_entity_types" not in self._stubs: + self._stubs["batch_delete_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchDeleteEntityTypes", + request_serializer=entity_type.BatchDeleteEntityTypesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_entity_types"] + + @property + def batch_create_entities( + self, + ) -> Callable[ + [entity_type.BatchCreateEntitiesRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch create entities method over gRPC. + + Creates multiple new entities in the specified entity type. + + Operation + + Returns: + Callable[[~.BatchCreateEntitiesRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_create_entities" not in self._stubs: + self._stubs["batch_create_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchCreateEntities", + request_serializer=entity_type.BatchCreateEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_create_entities"] + + @property + def batch_update_entities( + self, + ) -> Callable[ + [entity_type.BatchUpdateEntitiesRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch update entities method over gRPC. + + Updates or creates multiple entities in the specified entity + type. This method does not affect entities in the entity type + that aren't explicitly specified in the request. + + Operation + + Returns: + Callable[[~.BatchUpdateEntitiesRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_entities" not in self._stubs: + self._stubs["batch_update_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchUpdateEntities", + request_serializer=entity_type.BatchUpdateEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_entities"] + + @property + def batch_delete_entities( + self, + ) -> Callable[ + [entity_type.BatchDeleteEntitiesRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch delete entities method over gRPC. + + Deletes entities in the specified entity type. + + Operation + + Returns: + Callable[[~.BatchDeleteEntitiesRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_entities" not in self._stubs: + self._stubs["batch_delete_entities"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.EntityTypes/BatchDeleteEntities", + request_serializer=entity_type.BatchDeleteEntitiesRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_entities"] + + +__all__ = ("EntityTypesGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/environments/__init__.py b/google/cloud/dialogflow_v2beta1/services/environments/__init__.py new file mode 100644 index 000000000..a67f2316d --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/environments/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import EnvironmentsClient +from .async_client import EnvironmentsAsyncClient + +__all__ = ( + "EnvironmentsClient", + "EnvironmentsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2beta1/services/environments/async_client.py b/google/cloud/dialogflow_v2beta1/services/environments/async_client.py new file mode 100644 index 000000000..4b794f4ef --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/environments/async_client.py @@ -0,0 +1,237 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2beta1.services.environments import pagers +from google.cloud.dialogflow_v2beta1.types import environment + +from .transports.base import EnvironmentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import EnvironmentsGrpcAsyncIOTransport +from .client import EnvironmentsClient + + +class EnvironmentsAsyncClient: + """Service for managing + [Environments][google.cloud.dialogflow.v2beta1.Environment]. + """ + + _client: EnvironmentsClient + + DEFAULT_ENDPOINT = EnvironmentsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = EnvironmentsClient.DEFAULT_MTLS_ENDPOINT + + environment_path = staticmethod(EnvironmentsClient.environment_path) + parse_environment_path = staticmethod(EnvironmentsClient.parse_environment_path) + + common_billing_account_path = staticmethod( + EnvironmentsClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + EnvironmentsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(EnvironmentsClient.common_folder_path) + parse_common_folder_path = staticmethod(EnvironmentsClient.parse_common_folder_path) + + common_organization_path = staticmethod(EnvironmentsClient.common_organization_path) + parse_common_organization_path = staticmethod( + EnvironmentsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(EnvironmentsClient.common_project_path) + parse_common_project_path = staticmethod( + EnvironmentsClient.parse_common_project_path + ) + + common_location_path = staticmethod(EnvironmentsClient.common_location_path) + parse_common_location_path = staticmethod( + EnvironmentsClient.parse_common_location_path + ) + + from_service_account_file = EnvironmentsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> EnvironmentsTransport: + """Return the transport used by the client instance. + + Returns: + EnvironmentsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(EnvironmentsClient).get_transport_class, type(EnvironmentsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, EnvironmentsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the environments client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.EnvironmentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = EnvironmentsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_environments( + self, + request: environment.ListEnvironmentsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEnvironmentsAsyncPager: + r"""Returns the list of all non-draft environments of the + specified agent. + + Args: + request (:class:`~.environment.ListEnvironmentsRequest`): + The request object. The request message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. + parent (:class:`str`): + Required. The agent to list all environments from. + Format: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListEnvironmentsAsyncPager: + The response message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = environment.ListEnvironmentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_environments, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("EnvironmentsAsyncClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/environments/client.py b/google/cloud/dialogflow_v2beta1/services/environments/client.py new file mode 100644 index 000000000..7e6dc33ed --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/environments/client.py @@ -0,0 +1,430 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2beta1.services.environments import pagers +from google.cloud.dialogflow_v2beta1.types import environment + +from .transports.base import EnvironmentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import EnvironmentsGrpcTransport +from .transports.grpc_asyncio import EnvironmentsGrpcAsyncIOTransport + + +class EnvironmentsClientMeta(type): + """Metaclass for the Environments client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[EnvironmentsTransport]] + _transport_registry["grpc"] = EnvironmentsGrpcTransport + _transport_registry["grpc_asyncio"] = EnvironmentsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[EnvironmentsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class EnvironmentsClient(metaclass=EnvironmentsClientMeta): + """Service for managing + [Environments][google.cloud.dialogflow.v2beta1.Environment]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> EnvironmentsTransport: + """Return the transport used by the client instance. + + Returns: + EnvironmentsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def environment_path(project: str, environment: str,) -> str: + """Return a fully-qualified environment string.""" + return "projects/{project}/agent/environments/{environment}".format( + project=project, environment=environment, + ) + + @staticmethod + def parse_environment_path(path: str) -> Dict[str, str]: + """Parse a environment path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/environments/(?P.+?)$", path + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, EnvironmentsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the environments client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.EnvironmentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, EnvironmentsTransport): + # transport is a EnvironmentsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_environments( + self, + request: environment.ListEnvironmentsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEnvironmentsPager: + r"""Returns the list of all non-draft environments of the + specified agent. + + Args: + request (:class:`~.environment.ListEnvironmentsRequest`): + The request object. The request message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. + parent (:class:`str`): + Required. The agent to list all environments from. + Format: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListEnvironmentsPager: + The response message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a environment.ListEnvironmentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, environment.ListEnvironmentsRequest): + request = environment.ListEnvironmentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_environments] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("EnvironmentsClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/environments/pagers.py b/google/cloud/dialogflow_v2beta1/services/environments/pagers.py new file mode 100644 index 000000000..d366c65f8 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/environments/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2beta1.types import environment + + +class ListEnvironmentsPager: + """A pager for iterating through ``list_environments`` requests. + + This class thinly wraps an initial + :class:`~.environment.ListEnvironmentsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``environments`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListEnvironments`` requests and continue to iterate + through the ``environments`` field on the + corresponding responses. + + All the usual :class:`~.environment.ListEnvironmentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., environment.ListEnvironmentsResponse], + request: environment.ListEnvironmentsRequest, + response: environment.ListEnvironmentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.environment.ListEnvironmentsRequest`): + The initial request object. + response (:class:`~.environment.ListEnvironmentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = environment.ListEnvironmentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[environment.ListEnvironmentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[environment.Environment]: + for page in self.pages: + yield from page.environments + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListEnvironmentsAsyncPager: + """A pager for iterating through ``list_environments`` requests. + + This class thinly wraps an initial + :class:`~.environment.ListEnvironmentsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``environments`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListEnvironments`` requests and continue to iterate + through the ``environments`` field on the + corresponding responses. + + All the usual :class:`~.environment.ListEnvironmentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[environment.ListEnvironmentsResponse]], + request: environment.ListEnvironmentsRequest, + response: environment.ListEnvironmentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.environment.ListEnvironmentsRequest`): + The initial request object. + response (:class:`~.environment.ListEnvironmentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = environment.ListEnvironmentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[environment.ListEnvironmentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[environment.Environment]: + async def async_generator(): + async for page in self.pages: + for response in page.environments: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2beta1/services/environments/transports/__init__.py b/google/cloud/dialogflow_v2beta1/services/environments/transports/__init__.py new file mode 100644 index 000000000..14f04446c --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/environments/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import EnvironmentsTransport +from .grpc import EnvironmentsGrpcTransport +from .grpc_asyncio import EnvironmentsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[EnvironmentsTransport]] +_transport_registry["grpc"] = EnvironmentsGrpcTransport +_transport_registry["grpc_asyncio"] = EnvironmentsGrpcAsyncIOTransport + + +__all__ = ( + "EnvironmentsTransport", + "EnvironmentsGrpcTransport", + "EnvironmentsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2beta1/services/environments/transports/base.py b/google/cloud/dialogflow_v2beta1/services/environments/transports/base.py new file mode 100644 index 000000000..1a452c274 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/environments/transports/base.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2beta1.types import environment + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class EnvironmentsTransport(abc.ABC): + """Abstract transport class for Environments.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + 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, + ), + } + + @property + def list_environments( + self, + ) -> typing.Callable[ + [environment.ListEnvironmentsRequest], + typing.Union[ + environment.ListEnvironmentsResponse, + typing.Awaitable[environment.ListEnvironmentsResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("EnvironmentsTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/environments/transports/grpc.py b/google/cloud/dialogflow_v2beta1/services/environments/transports/grpc.py new file mode 100644 index 000000000..c7863b349 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/environments/transports/grpc.py @@ -0,0 +1,263 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2beta1.types import environment + +from .base import EnvironmentsTransport, DEFAULT_CLIENT_INFO + + +class EnvironmentsGrpcTransport(EnvironmentsTransport): + """gRPC backend transport for Environments. + + Service for managing + [Environments][google.cloud.dialogflow.v2beta1.Environment]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def list_environments( + self, + ) -> Callable[ + [environment.ListEnvironmentsRequest], environment.ListEnvironmentsResponse + ]: + r"""Return a callable for the list environments method over gRPC. + + Returns the list of all non-draft environments of the + specified agent. + + Returns: + Callable[[~.ListEnvironmentsRequest], + ~.ListEnvironmentsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_environments" not in self._stubs: + self._stubs["list_environments"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Environments/ListEnvironments", + request_serializer=environment.ListEnvironmentsRequest.serialize, + response_deserializer=environment.ListEnvironmentsResponse.deserialize, + ) + return self._stubs["list_environments"] + + +__all__ = ("EnvironmentsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/environments/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2beta1/services/environments/transports/grpc_asyncio.py new file mode 100644 index 000000000..7b96176c6 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/environments/transports/grpc_asyncio.py @@ -0,0 +1,268 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2beta1.types import environment + +from .base import EnvironmentsTransport, DEFAULT_CLIENT_INFO +from .grpc import EnvironmentsGrpcTransport + + +class EnvironmentsGrpcAsyncIOTransport(EnvironmentsTransport): + """gRPC AsyncIO backend transport for Environments. + + Service for managing + [Environments][google.cloud.dialogflow.v2beta1.Environment]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def list_environments( + self, + ) -> Callable[ + [environment.ListEnvironmentsRequest], + Awaitable[environment.ListEnvironmentsResponse], + ]: + r"""Return a callable for the list environments method over gRPC. + + Returns the list of all non-draft environments of the + specified agent. + + Returns: + Callable[[~.ListEnvironmentsRequest], + Awaitable[~.ListEnvironmentsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_environments" not in self._stubs: + self._stubs["list_environments"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Environments/ListEnvironments", + request_serializer=environment.ListEnvironmentsRequest.serialize, + response_deserializer=environment.ListEnvironmentsResponse.deserialize, + ) + return self._stubs["list_environments"] + + +__all__ = ("EnvironmentsGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/intents/__init__.py b/google/cloud/dialogflow_v2beta1/services/intents/__init__.py new file mode 100644 index 000000000..8719a9b64 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/intents/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import IntentsClient +from .async_client import IntentsAsyncClient + +__all__ = ( + "IntentsClient", + "IntentsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2beta1/services/intents/async_client.py b/google/cloud/dialogflow_v2beta1/services/intents/async_client.py new file mode 100644 index 000000000..cf947f90a --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/intents/async_client.py @@ -0,0 +1,848 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2beta1.services.intents import pagers +from google.cloud.dialogflow_v2beta1.types import context +from google.cloud.dialogflow_v2beta1.types import intent +from google.cloud.dialogflow_v2beta1.types import intent as gcd_intent +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import IntentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import IntentsGrpcAsyncIOTransport +from .client import IntentsClient + + +class IntentsAsyncClient: + """Service for managing + [Intents][google.cloud.dialogflow.v2beta1.Intent]. + """ + + _client: IntentsClient + + DEFAULT_ENDPOINT = IntentsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = IntentsClient.DEFAULT_MTLS_ENDPOINT + + context_path = staticmethod(IntentsClient.context_path) + parse_context_path = staticmethod(IntentsClient.parse_context_path) + intent_path = staticmethod(IntentsClient.intent_path) + parse_intent_path = staticmethod(IntentsClient.parse_intent_path) + + common_billing_account_path = staticmethod( + IntentsClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + IntentsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(IntentsClient.common_folder_path) + parse_common_folder_path = staticmethod(IntentsClient.parse_common_folder_path) + + common_organization_path = staticmethod(IntentsClient.common_organization_path) + parse_common_organization_path = staticmethod( + IntentsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(IntentsClient.common_project_path) + parse_common_project_path = staticmethod(IntentsClient.parse_common_project_path) + + common_location_path = staticmethod(IntentsClient.common_location_path) + parse_common_location_path = staticmethod(IntentsClient.parse_common_location_path) + + from_service_account_file = IntentsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> IntentsTransport: + """Return the transport used by the client instance. + + Returns: + IntentsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(IntentsClient).get_transport_class, type(IntentsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, IntentsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the intents client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.IntentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = IntentsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_intents( + self, + request: intent.ListIntentsRequest = None, + *, + parent: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListIntentsAsyncPager: + r"""Returns the list of all intents in the specified + agent. + + Args: + request (:class:`~.intent.ListIntentsRequest`): + The request object. The request message for + [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. + parent (:class:`str`): + Required. The agent to list all intents from. Format: + ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListIntentsAsyncPager: + The response message for + [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = intent.ListIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_intents, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def get_intent( + self, + request: intent.GetIntentRequest = None, + *, + name: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> intent.Intent: + r"""Retrieves the specified intent. + + Args: + request (:class:`~.intent.GetIntentRequest`): + The request object. The request message for + [Intents.GetIntent][google.cloud.dialogflow.v2beta1.Intents.GetIntent]. + name (:class:`str`): + Required. The name of the intent. Supported formats: + + - ``projects//agent/intents/`` + - ``projects//locations//agent/intents/`` + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = intent.GetIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_intent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_intent( + self, + request: gcd_intent.CreateIntentRequest = None, + *, + parent: str = None, + intent: gcd_intent.Intent = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_intent.Intent: + r"""Creates an intent in the specified agent. + + Args: + request (:class:`~.gcd_intent.CreateIntentRequest`): + The request object. The request message for + [Intents.CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent]. + parent (:class:`str`): + Required. The agent to create a intent for. Supported + formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent (:class:`~.gcd_intent.Intent`): + Required. The intent to create. + This corresponds to the ``intent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_intent.CreateIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if intent is not None: + request.intent = intent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_intent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def update_intent( + self, + request: gcd_intent.UpdateIntentRequest = None, + *, + intent: gcd_intent.Intent = None, + update_mask: field_mask.FieldMask = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_intent.Intent: + r"""Updates the specified intent. + + Args: + request (:class:`~.gcd_intent.UpdateIntentRequest`): + The request object. The request message for + [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent]. + intent (:class:`~.gcd_intent.Intent`): + Required. The intent to update. + This corresponds to the ``intent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([intent, update_mask, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_intent.UpdateIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if intent is not None: + request.intent = intent + if update_mask is not None: + request.update_mask = update_mask + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_intent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("intent.name", request.intent.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_intent( + self, + request: intent.DeleteIntentRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified intent and its direct or + indirect followup intents. + + Args: + request (:class:`~.intent.DeleteIntentRequest`): + The request object. The request message for + [Intents.DeleteIntent][google.cloud.dialogflow.v2beta1.Intents.DeleteIntent]. + name (:class:`str`): + Required. The name of the intent to delete. If this + intent has direct or indirect followup intents, we also + delete them. + + Supported formats: + + - ``projects//agent/intents/`` + - ``projects//locations//agent/intents/`` + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = intent.DeleteIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_intent, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def batch_update_intents( + self, + request: intent.BatchUpdateIntentsRequest = None, + *, + parent: str = None, + intent_batch_uri: str = None, + intent_batch_inline: intent.IntentBatch = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates/Creates multiple intents in the specified agent. + + Operation + + Args: + request (:class:`~.intent.BatchUpdateIntentsRequest`): + The request object. The request message for + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. + parent (:class:`str`): + Required. The name of the agent to update or create + intents in. Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent_batch_uri (:class:`str`): + The URI to a Google Cloud Storage + file containing intents to update or + create. The file format can either be a + serialized proto (of IntentBatch type) + or JSON object. Note: The URI must start + with "gs://". + This corresponds to the ``intent_batch_uri`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent_batch_inline (:class:`~.intent.IntentBatch`): + The collection of intents to update + or create. + This corresponds to the ``intent_batch_inline`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.intent.BatchUpdateIntentsResponse``: The + response message for + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intent_batch_uri, intent_batch_inline]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = intent.BatchUpdateIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if intent_batch_uri is not None: + request.intent_batch_uri = intent_batch_uri + if intent_batch_inline is not None: + request.intent_batch_inline = intent_batch_inline + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_update_intents, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + intent.BatchUpdateIntentsResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + async def batch_delete_intents( + self, + request: intent.BatchDeleteIntentsRequest = None, + *, + parent: str = None, + intents: Sequence[intent.Intent] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes intents in the specified agent. + + Operation + + Args: + request (:class:`~.intent.BatchDeleteIntentsRequest`): + The request object. The request message for + [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents]. + parent (:class:`str`): + Required. The name of the agent to delete all entities + types for. Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intents (:class:`Sequence[~.intent.Intent]`): + Required. The collection of intents to delete. Only + intent ``name`` must be filled in. + This corresponds to the ``intents`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intents]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = intent.BatchDeleteIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + if intents: + request.intents.extend(intents) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_delete_intents, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("IntentsAsyncClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/intents/client.py b/google/cloud/dialogflow_v2beta1/services/intents/client.py new file mode 100644 index 000000000..5c5ff03f2 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/intents/client.py @@ -0,0 +1,1063 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.dialogflow_v2beta1.services.intents import pagers +from google.cloud.dialogflow_v2beta1.types import context +from google.cloud.dialogflow_v2beta1.types import intent +from google.cloud.dialogflow_v2beta1.types import intent as gcd_intent +from google.protobuf import empty_pb2 as empty # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + +from .transports.base import IntentsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import IntentsGrpcTransport +from .transports.grpc_asyncio import IntentsGrpcAsyncIOTransport + + +class IntentsClientMeta(type): + """Metaclass for the Intents client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[IntentsTransport]] + _transport_registry["grpc"] = IntentsGrpcTransport + _transport_registry["grpc_asyncio"] = IntentsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[IntentsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class IntentsClient(metaclass=IntentsClientMeta): + """Service for managing + [Intents][google.cloud.dialogflow.v2beta1.Intent]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> IntentsTransport: + """Return the transport used by the client instance. + + Returns: + IntentsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def context_path(project: str, session: str, context: str,) -> str: + """Return a fully-qualified context string.""" + return "projects/{project}/agent/sessions/{session}/contexts/{context}".format( + project=project, session=session, context=context, + ) + + @staticmethod + def parse_context_path(path: str) -> Dict[str, str]: + """Parse a context path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/contexts/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def intent_path(project: str, intent: str,) -> str: + """Return a fully-qualified intent string.""" + return "projects/{project}/agent/intents/{intent}".format( + project=project, intent=intent, + ) + + @staticmethod + def parse_intent_path(path: str) -> Dict[str, str]: + """Parse a intent path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/agent/intents/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, IntentsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the intents client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.IntentsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, IntentsTransport): + # transport is a IntentsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_intents( + self, + request: intent.ListIntentsRequest = None, + *, + parent: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListIntentsPager: + r"""Returns the list of all intents in the specified + agent. + + Args: + request (:class:`~.intent.ListIntentsRequest`): + The request object. The request message for + [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. + parent (:class:`str`): + Required. The agent to list all intents from. Format: + ``projects//agent``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListIntentsPager: + The response message for + [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a intent.ListIntentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, intent.ListIntentsRequest): + request = intent.ListIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_intents] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def get_intent( + self, + request: intent.GetIntentRequest = None, + *, + name: str = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> intent.Intent: + r"""Retrieves the specified intent. + + Args: + request (:class:`~.intent.GetIntentRequest`): + The request object. The request message for + [Intents.GetIntent][google.cloud.dialogflow.v2beta1.Intents.GetIntent]. + name (:class:`str`): + Required. The name of the intent. Supported formats: + + - ``projects//agent/intents/`` + - ``projects//locations//agent/intents/`` + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a intent.GetIntentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, intent.GetIntentRequest): + request = intent.GetIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_intent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_intent( + self, + request: gcd_intent.CreateIntentRequest = None, + *, + parent: str = None, + intent: gcd_intent.Intent = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_intent.Intent: + r"""Creates an intent in the specified agent. + + Args: + request (:class:`~.gcd_intent.CreateIntentRequest`): + The request object. The request message for + [Intents.CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent]. + parent (:class:`str`): + Required. The agent to create a intent for. Supported + formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent (:class:`~.gcd_intent.Intent`): + Required. The intent to create. + This corresponds to the ``intent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intent, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_intent.CreateIntentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_intent.CreateIntentRequest): + request = gcd_intent.CreateIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if intent is not None: + request.intent = intent + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_intent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def update_intent( + self, + request: gcd_intent.UpdateIntentRequest = None, + *, + intent: gcd_intent.Intent = None, + update_mask: field_mask.FieldMask = None, + language_code: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_intent.Intent: + r"""Updates the specified intent. + + Args: + request (:class:`~.gcd_intent.UpdateIntentRequest`): + The request object. The request message for + [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent]. + intent (:class:`~.gcd_intent.Intent`): + Required. The intent to update. + This corresponds to the ``intent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + language_code (:class:`str`): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + This corresponds to the ``language_code`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_intent.Intent: + An intent categorizes an end-user's intention for one + conversation turn. For each agent, you define many + intents, where your combined intents can handle a + complete conversation. When an end-user writes or says + something, referred to as an end-user expression or + end-user input, Dialogflow matches the end-user input to + the best intent in your agent. Matching an intent is + also known as intent classification. + + For more information, see the `intent + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([intent, update_mask, language_code]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_intent.UpdateIntentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_intent.UpdateIntentRequest): + request = gcd_intent.UpdateIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if intent is not None: + request.intent = intent + if update_mask is not None: + request.update_mask = update_mask + if language_code is not None: + request.language_code = language_code + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_intent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("intent.name", request.intent.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_intent( + self, + request: intent.DeleteIntentRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified intent and its direct or + indirect followup intents. + + Args: + request (:class:`~.intent.DeleteIntentRequest`): + The request object. The request message for + [Intents.DeleteIntent][google.cloud.dialogflow.v2beta1.Intents.DeleteIntent]. + name (:class:`str`): + Required. The name of the intent to delete. If this + intent has direct or indirect followup intents, we also + delete them. + + Supported formats: + + - ``projects//agent/intents/`` + - ``projects//locations//agent/intents/`` + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a intent.DeleteIntentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, intent.DeleteIntentRequest): + request = intent.DeleteIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_intent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def batch_update_intents( + self, + request: intent.BatchUpdateIntentsRequest = None, + *, + parent: str = None, + intent_batch_uri: str = None, + intent_batch_inline: intent.IntentBatch = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates/Creates multiple intents in the specified agent. + + Operation + + Args: + request (:class:`~.intent.BatchUpdateIntentsRequest`): + The request object. The request message for + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. + parent (:class:`str`): + Required. The name of the agent to update or create + intents in. Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent_batch_uri (:class:`str`): + The URI to a Google Cloud Storage + file containing intents to update or + create. The file format can either be a + serialized proto (of IntentBatch type) + or JSON object. Note: The URI must start + with "gs://". + This corresponds to the ``intent_batch_uri`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intent_batch_inline (:class:`~.intent.IntentBatch`): + The collection of intents to update + or create. + This corresponds to the ``intent_batch_inline`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.intent.BatchUpdateIntentsResponse``: The + response message for + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intent_batch_uri, intent_batch_inline]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a intent.BatchUpdateIntentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, intent.BatchUpdateIntentsRequest): + request = intent.BatchUpdateIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if intent_batch_uri is not None: + request.intent_batch_uri = intent_batch_uri + if intent_batch_inline is not None: + request.intent_batch_inline = intent_batch_inline + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_update_intents] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + intent.BatchUpdateIntentsResponse, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + def batch_delete_intents( + self, + request: intent.BatchDeleteIntentsRequest = None, + *, + parent: str = None, + intents: Sequence[intent.Intent] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes intents in the specified agent. + + Operation + + Args: + request (:class:`~.intent.BatchDeleteIntentsRequest`): + The request object. The request message for + [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents]. + parent (:class:`str`): + Required. The name of the agent to delete all entities + types for. Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + intents (:class:`Sequence[~.intent.Intent]`): + Required. The collection of intents to delete. Only + intent ``name`` must be filled in. + This corresponds to the ``intents`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: + + :: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + + The JSON representation for ``Empty`` is empty JSON + object ``{}``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, intents]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a intent.BatchDeleteIntentsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, intent.BatchDeleteIntentsRequest): + request = intent.BatchDeleteIntentsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + if intents: + request.intents.extend(intents) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_delete_intents] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty.Empty, + metadata_type=struct.Struct, + ) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("IntentsClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/intents/pagers.py b/google/cloud/dialogflow_v2beta1/services/intents/pagers.py new file mode 100644 index 000000000..6203ee246 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/intents/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2beta1.types import intent + + +class ListIntentsPager: + """A pager for iterating through ``list_intents`` requests. + + This class thinly wraps an initial + :class:`~.intent.ListIntentsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``intents`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListIntents`` requests and continue to iterate + through the ``intents`` field on the + corresponding responses. + + All the usual :class:`~.intent.ListIntentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., intent.ListIntentsResponse], + request: intent.ListIntentsRequest, + response: intent.ListIntentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.intent.ListIntentsRequest`): + The initial request object. + response (:class:`~.intent.ListIntentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = intent.ListIntentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[intent.ListIntentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[intent.Intent]: + for page in self.pages: + yield from page.intents + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListIntentsAsyncPager: + """A pager for iterating through ``list_intents`` requests. + + This class thinly wraps an initial + :class:`~.intent.ListIntentsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``intents`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListIntents`` requests and continue to iterate + through the ``intents`` field on the + corresponding responses. + + All the usual :class:`~.intent.ListIntentsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[intent.ListIntentsResponse]], + request: intent.ListIntentsRequest, + response: intent.ListIntentsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.intent.ListIntentsRequest`): + The initial request object. + response (:class:`~.intent.ListIntentsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = intent.ListIntentsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[intent.ListIntentsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[intent.Intent]: + async def async_generator(): + async for page in self.pages: + for response in page.intents: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2beta1/services/intents/transports/__init__.py b/google/cloud/dialogflow_v2beta1/services/intents/transports/__init__.py new file mode 100644 index 000000000..ecbfad6b0 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/intents/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import IntentsTransport +from .grpc import IntentsGrpcTransport +from .grpc_asyncio import IntentsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[IntentsTransport]] +_transport_registry["grpc"] = IntentsGrpcTransport +_transport_registry["grpc_asyncio"] = IntentsGrpcAsyncIOTransport + + +__all__ = ( + "IntentsTransport", + "IntentsGrpcTransport", + "IntentsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2beta1/services/intents/transports/base.py b/google/cloud/dialogflow_v2beta1/services/intents/transports/base.py new file mode 100644 index 000000000..5c57ffe4a --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/intents/transports/base.py @@ -0,0 +1,214 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2beta1.types import intent +from google.cloud.dialogflow_v2beta1.types import intent as gcd_intent +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class IntentsTransport(abc.ABC): + """Abstract transport class for Intents.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + 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.get_intent: gapic_v1.method.wrap_method( + 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.update_intent: gapic_v1.method.wrap_method( + 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.batch_update_intents: gapic_v1.method.wrap_method( + self.batch_update_intents, + default_timeout=None, + client_info=client_info, + ), + self.batch_delete_intents: gapic_v1.method.wrap_method( + self.batch_delete_intents, + default_timeout=None, + client_info=client_info, + ), + } + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def list_intents( + self, + ) -> typing.Callable[ + [intent.ListIntentsRequest], + typing.Union[ + intent.ListIntentsResponse, typing.Awaitable[intent.ListIntentsResponse] + ], + ]: + raise NotImplementedError() + + @property + def get_intent( + self, + ) -> typing.Callable[ + [intent.GetIntentRequest], + typing.Union[intent.Intent, typing.Awaitable[intent.Intent]], + ]: + raise NotImplementedError() + + @property + def create_intent( + self, + ) -> typing.Callable[ + [gcd_intent.CreateIntentRequest], + typing.Union[gcd_intent.Intent, typing.Awaitable[gcd_intent.Intent]], + ]: + raise NotImplementedError() + + @property + def update_intent( + self, + ) -> typing.Callable[ + [gcd_intent.UpdateIntentRequest], + typing.Union[gcd_intent.Intent, typing.Awaitable[gcd_intent.Intent]], + ]: + raise NotImplementedError() + + @property + def delete_intent( + self, + ) -> typing.Callable[ + [intent.DeleteIntentRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def batch_update_intents( + self, + ) -> typing.Callable[ + [intent.BatchUpdateIntentsRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def batch_delete_intents( + self, + ) -> typing.Callable[ + [intent.BatchDeleteIntentsRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + +__all__ = ("IntentsTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/intents/transports/grpc.py b/google/cloud/dialogflow_v2beta1/services/intents/transports/grpc.py new file mode 100644 index 000000000..22ced492c --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/intents/transports/grpc.py @@ -0,0 +1,440 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2beta1.types import intent +from google.cloud.dialogflow_v2beta1.types import intent as gcd_intent +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import IntentsTransport, DEFAULT_CLIENT_INFO + + +class IntentsGrpcTransport(IntentsTransport): + """gRPC backend transport for Intents. + + Service for managing + [Intents][google.cloud.dialogflow.v2beta1.Intent]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def list_intents( + self, + ) -> Callable[[intent.ListIntentsRequest], intent.ListIntentsResponse]: + r"""Return a callable for the list intents method over gRPC. + + Returns the list of all intents in the specified + agent. + + Returns: + Callable[[~.ListIntentsRequest], + ~.ListIntentsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_intents" not in self._stubs: + self._stubs["list_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/ListIntents", + request_serializer=intent.ListIntentsRequest.serialize, + response_deserializer=intent.ListIntentsResponse.deserialize, + ) + return self._stubs["list_intents"] + + @property + def get_intent(self) -> Callable[[intent.GetIntentRequest], intent.Intent]: + r"""Return a callable for the get intent method over gRPC. + + Retrieves the specified intent. + + Returns: + Callable[[~.GetIntentRequest], + ~.Intent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_intent" not in self._stubs: + self._stubs["get_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/GetIntent", + request_serializer=intent.GetIntentRequest.serialize, + response_deserializer=intent.Intent.deserialize, + ) + return self._stubs["get_intent"] + + @property + def create_intent( + self, + ) -> Callable[[gcd_intent.CreateIntentRequest], gcd_intent.Intent]: + r"""Return a callable for the create intent method over gRPC. + + Creates an intent in the specified agent. + + Returns: + Callable[[~.CreateIntentRequest], + ~.Intent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_intent" not in self._stubs: + self._stubs["create_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/CreateIntent", + request_serializer=gcd_intent.CreateIntentRequest.serialize, + response_deserializer=gcd_intent.Intent.deserialize, + ) + return self._stubs["create_intent"] + + @property + def update_intent( + self, + ) -> Callable[[gcd_intent.UpdateIntentRequest], gcd_intent.Intent]: + r"""Return a callable for the update intent method over gRPC. + + Updates the specified intent. + + Returns: + Callable[[~.UpdateIntentRequest], + ~.Intent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_intent" not in self._stubs: + self._stubs["update_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/UpdateIntent", + request_serializer=gcd_intent.UpdateIntentRequest.serialize, + response_deserializer=gcd_intent.Intent.deserialize, + ) + return self._stubs["update_intent"] + + @property + def delete_intent(self) -> Callable[[intent.DeleteIntentRequest], empty.Empty]: + r"""Return a callable for the delete intent method over gRPC. + + Deletes the specified intent and its direct or + indirect followup intents. + + Returns: + Callable[[~.DeleteIntentRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_intent" not in self._stubs: + self._stubs["delete_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/DeleteIntent", + request_serializer=intent.DeleteIntentRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_intent"] + + @property + def batch_update_intents( + self, + ) -> Callable[[intent.BatchUpdateIntentsRequest], operations.Operation]: + r"""Return a callable for the batch update intents method over gRPC. + + Updates/Creates multiple intents in the specified agent. + + Operation + + Returns: + Callable[[~.BatchUpdateIntentsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_intents" not in self._stubs: + self._stubs["batch_update_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/BatchUpdateIntents", + request_serializer=intent.BatchUpdateIntentsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_intents"] + + @property + def batch_delete_intents( + self, + ) -> Callable[[intent.BatchDeleteIntentsRequest], operations.Operation]: + r"""Return a callable for the batch delete intents method over gRPC. + + Deletes intents in the specified agent. + + Operation + + Returns: + Callable[[~.BatchDeleteIntentsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_intents" not in self._stubs: + self._stubs["batch_delete_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/BatchDeleteIntents", + request_serializer=intent.BatchDeleteIntentsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_intents"] + + +__all__ = ("IntentsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/intents/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2beta1/services/intents/transports/grpc_asyncio.py new file mode 100644 index 000000000..1fda67997 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/intents/transports/grpc_asyncio.py @@ -0,0 +1,448 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import operations_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2beta1.types import intent +from google.cloud.dialogflow_v2beta1.types import intent as gcd_intent +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import IntentsTransport, DEFAULT_CLIENT_INFO +from .grpc import IntentsGrpcTransport + + +class IntentsGrpcAsyncIOTransport(IntentsTransport): + """gRPC AsyncIO backend transport for Intents. + + Service for managing + [Intents][google.cloud.dialogflow.v2beta1.Intent]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def list_intents( + self, + ) -> Callable[[intent.ListIntentsRequest], Awaitable[intent.ListIntentsResponse]]: + r"""Return a callable for the list intents method over gRPC. + + Returns the list of all intents in the specified + agent. + + Returns: + Callable[[~.ListIntentsRequest], + Awaitable[~.ListIntentsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_intents" not in self._stubs: + self._stubs["list_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/ListIntents", + request_serializer=intent.ListIntentsRequest.serialize, + response_deserializer=intent.ListIntentsResponse.deserialize, + ) + return self._stubs["list_intents"] + + @property + def get_intent( + self, + ) -> Callable[[intent.GetIntentRequest], Awaitable[intent.Intent]]: + r"""Return a callable for the get intent method over gRPC. + + Retrieves the specified intent. + + Returns: + Callable[[~.GetIntentRequest], + Awaitable[~.Intent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_intent" not in self._stubs: + self._stubs["get_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/GetIntent", + request_serializer=intent.GetIntentRequest.serialize, + response_deserializer=intent.Intent.deserialize, + ) + return self._stubs["get_intent"] + + @property + def create_intent( + self, + ) -> Callable[[gcd_intent.CreateIntentRequest], Awaitable[gcd_intent.Intent]]: + r"""Return a callable for the create intent method over gRPC. + + Creates an intent in the specified agent. + + Returns: + Callable[[~.CreateIntentRequest], + Awaitable[~.Intent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_intent" not in self._stubs: + self._stubs["create_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/CreateIntent", + request_serializer=gcd_intent.CreateIntentRequest.serialize, + response_deserializer=gcd_intent.Intent.deserialize, + ) + return self._stubs["create_intent"] + + @property + def update_intent( + self, + ) -> Callable[[gcd_intent.UpdateIntentRequest], Awaitable[gcd_intent.Intent]]: + r"""Return a callable for the update intent method over gRPC. + + Updates the specified intent. + + Returns: + Callable[[~.UpdateIntentRequest], + Awaitable[~.Intent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_intent" not in self._stubs: + self._stubs["update_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/UpdateIntent", + request_serializer=gcd_intent.UpdateIntentRequest.serialize, + response_deserializer=gcd_intent.Intent.deserialize, + ) + return self._stubs["update_intent"] + + @property + def delete_intent( + self, + ) -> Callable[[intent.DeleteIntentRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete intent method over gRPC. + + Deletes the specified intent and its direct or + indirect followup intents. + + Returns: + Callable[[~.DeleteIntentRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_intent" not in self._stubs: + self._stubs["delete_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/DeleteIntent", + request_serializer=intent.DeleteIntentRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_intent"] + + @property + def batch_update_intents( + self, + ) -> Callable[[intent.BatchUpdateIntentsRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the batch update intents method over gRPC. + + Updates/Creates multiple intents in the specified agent. + + Operation + + Returns: + Callable[[~.BatchUpdateIntentsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_update_intents" not in self._stubs: + self._stubs["batch_update_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/BatchUpdateIntents", + request_serializer=intent.BatchUpdateIntentsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_intents"] + + @property + def batch_delete_intents( + self, + ) -> Callable[[intent.BatchDeleteIntentsRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the batch delete intents method over gRPC. + + Deletes intents in the specified agent. + + Operation + + Returns: + Callable[[~.BatchDeleteIntentsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "batch_delete_intents" not in self._stubs: + self._stubs["batch_delete_intents"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Intents/BatchDeleteIntents", + request_serializer=intent.BatchDeleteIntentsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_delete_intents"] + + +__all__ = ("IntentsGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/knowledge_bases/__init__.py b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/__init__.py new file mode 100644 index 000000000..be24a37d1 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import KnowledgeBasesClient +from .async_client import KnowledgeBasesAsyncClient + +__all__ = ( + "KnowledgeBasesClient", + "KnowledgeBasesAsyncClient", +) diff --git a/google/cloud/dialogflow_v2beta1/services/knowledge_bases/async_client.py b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/async_client.py new file mode 100644 index 000000000..350a0353f --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/async_client.py @@ -0,0 +1,592 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2beta1.services.knowledge_bases import pagers +from google.cloud.dialogflow_v2beta1.types import knowledge_base +from google.cloud.dialogflow_v2beta1.types import knowledge_base as gcd_knowledge_base +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + +from .transports.base import KnowledgeBasesTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import KnowledgeBasesGrpcAsyncIOTransport +from .client import KnowledgeBasesClient + + +class KnowledgeBasesAsyncClient: + """Service for managing + [KnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + """ + + _client: KnowledgeBasesClient + + DEFAULT_ENDPOINT = KnowledgeBasesClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = KnowledgeBasesClient.DEFAULT_MTLS_ENDPOINT + + knowledge_base_path = staticmethod(KnowledgeBasesClient.knowledge_base_path) + parse_knowledge_base_path = staticmethod( + KnowledgeBasesClient.parse_knowledge_base_path + ) + + common_billing_account_path = staticmethod( + KnowledgeBasesClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + KnowledgeBasesClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(KnowledgeBasesClient.common_folder_path) + parse_common_folder_path = staticmethod( + KnowledgeBasesClient.parse_common_folder_path + ) + + common_organization_path = staticmethod( + KnowledgeBasesClient.common_organization_path + ) + parse_common_organization_path = staticmethod( + KnowledgeBasesClient.parse_common_organization_path + ) + + common_project_path = staticmethod(KnowledgeBasesClient.common_project_path) + parse_common_project_path = staticmethod( + KnowledgeBasesClient.parse_common_project_path + ) + + common_location_path = staticmethod(KnowledgeBasesClient.common_location_path) + parse_common_location_path = staticmethod( + KnowledgeBasesClient.parse_common_location_path + ) + + from_service_account_file = KnowledgeBasesClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> KnowledgeBasesTransport: + """Return the transport used by the client instance. + + Returns: + KnowledgeBasesTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(KnowledgeBasesClient).get_transport_class, type(KnowledgeBasesClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, KnowledgeBasesTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the knowledge bases client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.KnowledgeBasesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = KnowledgeBasesClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_knowledge_bases( + self, + request: knowledge_base.ListKnowledgeBasesRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListKnowledgeBasesAsyncPager: + r"""Returns the list of all knowledge bases of the specified agent. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Args: + request (:class:`~.knowledge_base.ListKnowledgeBasesRequest`): + The request object. Request message for + [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. + parent (:class:`str`): + Required. The project to list of knowledge bases for. + Format: + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListKnowledgeBasesAsyncPager: + Response message for + [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = knowledge_base.ListKnowledgeBasesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_knowledge_bases, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.ListKnowledgeBasesAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_knowledge_base( + self, + request: knowledge_base.GetKnowledgeBaseRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> knowledge_base.KnowledgeBase: + r"""Retrieves the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Args: + request (:class:`~.knowledge_base.GetKnowledgeBaseRequest`): + The request object. Request message for + [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase]. + name (:class:`str`): + Required. The name of the knowledge base to retrieve. + Format + ``projects//locations//knowledgeBases/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.knowledge_base.KnowledgeBase: + A knowledge base represents a collection of knowledge + documents that you provide to Dialogflow. Your knowledge + documents contain information that may be useful during + conversations with end-users. Some Dialogflow features + use knowledge bases when looking for a response to an + end-user input. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = knowledge_base.GetKnowledgeBaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_knowledge_base, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_knowledge_base( + self, + request: gcd_knowledge_base.CreateKnowledgeBaseRequest = None, + *, + parent: str = None, + knowledge_base: gcd_knowledge_base.KnowledgeBase = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_knowledge_base.KnowledgeBase: + r"""Creates a knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Args: + request (:class:`~.gcd_knowledge_base.CreateKnowledgeBaseRequest`): + The request object. Request message for + [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase]. + parent (:class:`str`): + Required. The project to create a knowledge base for. + Format: + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + knowledge_base (:class:`~.gcd_knowledge_base.KnowledgeBase`): + Required. The knowledge base to + create. + This corresponds to the ``knowledge_base`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_knowledge_base.KnowledgeBase: + A knowledge base represents a collection of knowledge + documents that you provide to Dialogflow. Your knowledge + documents contain information that may be useful during + conversations with end-users. Some Dialogflow features + use knowledge bases when looking for a response to an + end-user input. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, knowledge_base]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_knowledge_base.CreateKnowledgeBaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if knowledge_base is not None: + request.knowledge_base = knowledge_base + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_knowledge_base, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_knowledge_base( + self, + request: knowledge_base.DeleteKnowledgeBaseRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Args: + request (:class:`~.knowledge_base.DeleteKnowledgeBaseRequest`): + The request object. Request message for + [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase]. + name (:class:`str`): + Required. The name of the knowledge base to delete. + Format: + ``projects//locations//knowledgeBases/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = knowledge_base.DeleteKnowledgeBaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_knowledge_base, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def update_knowledge_base( + self, + request: gcd_knowledge_base.UpdateKnowledgeBaseRequest = None, + *, + knowledge_base: gcd_knowledge_base.KnowledgeBase = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_knowledge_base.KnowledgeBase: + r"""Updates the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Args: + request (:class:`~.gcd_knowledge_base.UpdateKnowledgeBaseRequest`): + The request object. Request message for + [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase]. + knowledge_base (:class:`~.gcd_knowledge_base.KnowledgeBase`): + Required. The knowledge base to + update. + This corresponds to the ``knowledge_base`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. Not specified means ``update all``. Currently, + only ``display_name`` can be updated, an InvalidArgument + will be returned for attempting to update other fields. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_knowledge_base.KnowledgeBase: + A knowledge base represents a collection of knowledge + documents that you provide to Dialogflow. Your knowledge + documents contain information that may be useful during + conversations with end-users. Some Dialogflow features + use knowledge bases when looking for a response to an + end-user input. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([knowledge_base, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_knowledge_base.UpdateKnowledgeBaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if knowledge_base is not None: + request.knowledge_base = knowledge_base + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_knowledge_base, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("knowledge_base.name", request.knowledge_base.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("KnowledgeBasesAsyncClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/knowledge_bases/client.py b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/client.py new file mode 100644 index 000000000..6df8d15e4 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/client.py @@ -0,0 +1,785 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2beta1.services.knowledge_bases import pagers +from google.cloud.dialogflow_v2beta1.types import knowledge_base +from google.cloud.dialogflow_v2beta1.types import knowledge_base as gcd_knowledge_base +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + +from .transports.base import KnowledgeBasesTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import KnowledgeBasesGrpcTransport +from .transports.grpc_asyncio import KnowledgeBasesGrpcAsyncIOTransport + + +class KnowledgeBasesClientMeta(type): + """Metaclass for the KnowledgeBases client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[KnowledgeBasesTransport]] + _transport_registry["grpc"] = KnowledgeBasesGrpcTransport + _transport_registry["grpc_asyncio"] = KnowledgeBasesGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[KnowledgeBasesTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class KnowledgeBasesClient(metaclass=KnowledgeBasesClientMeta): + """Service for managing + [KnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> KnowledgeBasesTransport: + """Return the transport used by the client instance. + + Returns: + KnowledgeBasesTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def knowledge_base_path(project: str, knowledge_base: str,) -> str: + """Return a fully-qualified knowledge_base string.""" + return "projects/{project}/knowledgeBases/{knowledge_base}".format( + project=project, knowledge_base=knowledge_base, + ) + + @staticmethod + def parse_knowledge_base_path(path: str) -> Dict[str, str]: + """Parse a knowledge_base path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/knowledgeBases/(?P.+?)$", path + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, KnowledgeBasesTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the knowledge bases client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.KnowledgeBasesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, KnowledgeBasesTransport): + # transport is a KnowledgeBasesTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_knowledge_bases( + self, + request: knowledge_base.ListKnowledgeBasesRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListKnowledgeBasesPager: + r"""Returns the list of all knowledge bases of the specified agent. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Args: + request (:class:`~.knowledge_base.ListKnowledgeBasesRequest`): + The request object. Request message for + [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. + parent (:class:`str`): + Required. The project to list of knowledge bases for. + Format: + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListKnowledgeBasesPager: + Response message for + [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a knowledge_base.ListKnowledgeBasesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, knowledge_base.ListKnowledgeBasesRequest): + request = knowledge_base.ListKnowledgeBasesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_knowledge_bases] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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.ListKnowledgeBasesPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def get_knowledge_base( + self, + request: knowledge_base.GetKnowledgeBaseRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> knowledge_base.KnowledgeBase: + r"""Retrieves the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Args: + request (:class:`~.knowledge_base.GetKnowledgeBaseRequest`): + The request object. Request message for + [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase]. + name (:class:`str`): + Required. The name of the knowledge base to retrieve. + Format + ``projects//locations//knowledgeBases/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.knowledge_base.KnowledgeBase: + A knowledge base represents a collection of knowledge + documents that you provide to Dialogflow. Your knowledge + documents contain information that may be useful during + conversations with end-users. Some Dialogflow features + use knowledge bases when looking for a response to an + end-user input. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a knowledge_base.GetKnowledgeBaseRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, knowledge_base.GetKnowledgeBaseRequest): + request = knowledge_base.GetKnowledgeBaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_knowledge_base] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_knowledge_base( + self, + request: gcd_knowledge_base.CreateKnowledgeBaseRequest = None, + *, + parent: str = None, + knowledge_base: gcd_knowledge_base.KnowledgeBase = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_knowledge_base.KnowledgeBase: + r"""Creates a knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Args: + request (:class:`~.gcd_knowledge_base.CreateKnowledgeBaseRequest`): + The request object. Request message for + [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase]. + parent (:class:`str`): + Required. The project to create a knowledge base for. + Format: + ``projects//locations/``. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + knowledge_base (:class:`~.gcd_knowledge_base.KnowledgeBase`): + Required. The knowledge base to + create. + This corresponds to the ``knowledge_base`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_knowledge_base.KnowledgeBase: + A knowledge base represents a collection of knowledge + documents that you provide to Dialogflow. Your knowledge + documents contain information that may be useful during + conversations with end-users. Some Dialogflow features + use knowledge bases when looking for a response to an + end-user input. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, knowledge_base]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_knowledge_base.CreateKnowledgeBaseRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_knowledge_base.CreateKnowledgeBaseRequest): + request = gcd_knowledge_base.CreateKnowledgeBaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if knowledge_base is not None: + request.knowledge_base = knowledge_base + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_knowledge_base] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_knowledge_base( + self, + request: knowledge_base.DeleteKnowledgeBaseRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Args: + request (:class:`~.knowledge_base.DeleteKnowledgeBaseRequest`): + The request object. Request message for + [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase]. + name (:class:`str`): + Required. The name of the knowledge base to delete. + Format: + ``projects//locations//knowledgeBases/``. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a knowledge_base.DeleteKnowledgeBaseRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, knowledge_base.DeleteKnowledgeBaseRequest): + request = knowledge_base.DeleteKnowledgeBaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_knowledge_base] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def update_knowledge_base( + self, + request: gcd_knowledge_base.UpdateKnowledgeBaseRequest = None, + *, + knowledge_base: gcd_knowledge_base.KnowledgeBase = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_knowledge_base.KnowledgeBase: + r"""Updates the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Args: + request (:class:`~.gcd_knowledge_base.UpdateKnowledgeBaseRequest`): + The request object. Request message for + [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase]. + knowledge_base (:class:`~.gcd_knowledge_base.KnowledgeBase`): + Required. The knowledge base to + update. + This corresponds to the ``knowledge_base`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. Not specified means ``update all``. Currently, + only ``display_name`` can be updated, an InvalidArgument + will be returned for attempting to update other fields. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_knowledge_base.KnowledgeBase: + A knowledge base represents a collection of knowledge + documents that you provide to Dialogflow. Your knowledge + documents contain information that may be useful during + conversations with end-users. Some Dialogflow features + use knowledge bases when looking for a response to an + end-user input. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([knowledge_base, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_knowledge_base.UpdateKnowledgeBaseRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_knowledge_base.UpdateKnowledgeBaseRequest): + request = gcd_knowledge_base.UpdateKnowledgeBaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if knowledge_base is not None: + request.knowledge_base = knowledge_base + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_knowledge_base] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("knowledge_base.name", request.knowledge_base.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("KnowledgeBasesClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/knowledge_bases/pagers.py b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/pagers.py new file mode 100644 index 000000000..f58d0bcb7 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/pagers.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2beta1.types import knowledge_base + + +class ListKnowledgeBasesPager: + """A pager for iterating through ``list_knowledge_bases`` requests. + + This class thinly wraps an initial + :class:`~.knowledge_base.ListKnowledgeBasesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``knowledge_bases`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListKnowledgeBases`` requests and continue to iterate + through the ``knowledge_bases`` field on the + corresponding responses. + + All the usual :class:`~.knowledge_base.ListKnowledgeBasesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., knowledge_base.ListKnowledgeBasesResponse], + request: knowledge_base.ListKnowledgeBasesRequest, + response: knowledge_base.ListKnowledgeBasesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.knowledge_base.ListKnowledgeBasesRequest`): + The initial request object. + response (:class:`~.knowledge_base.ListKnowledgeBasesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = knowledge_base.ListKnowledgeBasesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[knowledge_base.ListKnowledgeBasesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[knowledge_base.KnowledgeBase]: + for page in self.pages: + yield from page.knowledge_bases + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListKnowledgeBasesAsyncPager: + """A pager for iterating through ``list_knowledge_bases`` requests. + + This class thinly wraps an initial + :class:`~.knowledge_base.ListKnowledgeBasesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``knowledge_bases`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListKnowledgeBases`` requests and continue to iterate + through the ``knowledge_bases`` field on the + corresponding responses. + + All the usual :class:`~.knowledge_base.ListKnowledgeBasesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[knowledge_base.ListKnowledgeBasesResponse]], + request: knowledge_base.ListKnowledgeBasesRequest, + response: knowledge_base.ListKnowledgeBasesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.knowledge_base.ListKnowledgeBasesRequest`): + The initial request object. + response (:class:`~.knowledge_base.ListKnowledgeBasesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = knowledge_base.ListKnowledgeBasesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[knowledge_base.ListKnowledgeBasesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[knowledge_base.KnowledgeBase]: + async def async_generator(): + async for page in self.pages: + for response in page.knowledge_bases: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/__init__.py b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/__init__.py new file mode 100644 index 000000000..70a64b134 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import KnowledgeBasesTransport +from .grpc import KnowledgeBasesGrpcTransport +from .grpc_asyncio import KnowledgeBasesGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[KnowledgeBasesTransport]] +_transport_registry["grpc"] = KnowledgeBasesGrpcTransport +_transport_registry["grpc_asyncio"] = KnowledgeBasesGrpcAsyncIOTransport + + +__all__ = ( + "KnowledgeBasesTransport", + "KnowledgeBasesGrpcTransport", + "KnowledgeBasesGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/base.py b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/base.py new file mode 100644 index 000000000..e013e1e1e --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/base.py @@ -0,0 +1,196 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2beta1.types import knowledge_base +from google.cloud.dialogflow_v2beta1.types import knowledge_base as gcd_knowledge_base +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class KnowledgeBasesTransport(abc.ABC): + """Abstract transport class for KnowledgeBases.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_knowledge_bases: gapic_v1.method.wrap_method( + self.list_knowledge_bases, + default_timeout=None, + client_info=client_info, + ), + self.get_knowledge_base: gapic_v1.method.wrap_method( + self.get_knowledge_base, default_timeout=None, client_info=client_info, + ), + self.create_knowledge_base: gapic_v1.method.wrap_method( + self.create_knowledge_base, + default_timeout=None, + client_info=client_info, + ), + self.delete_knowledge_base: gapic_v1.method.wrap_method( + self.delete_knowledge_base, + default_timeout=None, + client_info=client_info, + ), + self.update_knowledge_base: gapic_v1.method.wrap_method( + self.update_knowledge_base, + default_timeout=None, + client_info=client_info, + ), + } + + @property + def list_knowledge_bases( + self, + ) -> typing.Callable[ + [knowledge_base.ListKnowledgeBasesRequest], + typing.Union[ + knowledge_base.ListKnowledgeBasesResponse, + typing.Awaitable[knowledge_base.ListKnowledgeBasesResponse], + ], + ]: + raise NotImplementedError() + + @property + def get_knowledge_base( + self, + ) -> typing.Callable[ + [knowledge_base.GetKnowledgeBaseRequest], + typing.Union[ + knowledge_base.KnowledgeBase, typing.Awaitable[knowledge_base.KnowledgeBase] + ], + ]: + raise NotImplementedError() + + @property + def create_knowledge_base( + self, + ) -> typing.Callable[ + [gcd_knowledge_base.CreateKnowledgeBaseRequest], + typing.Union[ + gcd_knowledge_base.KnowledgeBase, + typing.Awaitable[gcd_knowledge_base.KnowledgeBase], + ], + ]: + raise NotImplementedError() + + @property + def delete_knowledge_base( + self, + ) -> typing.Callable[ + [knowledge_base.DeleteKnowledgeBaseRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def update_knowledge_base( + self, + ) -> typing.Callable[ + [gcd_knowledge_base.UpdateKnowledgeBaseRequest], + typing.Union[ + gcd_knowledge_base.KnowledgeBase, + typing.Awaitable[gcd_knowledge_base.KnowledgeBase], + ], + ]: + raise NotImplementedError() + + +__all__ = ("KnowledgeBasesTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/grpc.py b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/grpc.py new file mode 100644 index 000000000..c66ef6d9f --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/grpc.py @@ -0,0 +1,392 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2beta1.types import knowledge_base +from google.cloud.dialogflow_v2beta1.types import knowledge_base as gcd_knowledge_base +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import KnowledgeBasesTransport, DEFAULT_CLIENT_INFO + + +class KnowledgeBasesGrpcTransport(KnowledgeBasesTransport): + """gRPC backend transport for KnowledgeBases. + + Service for managing + [KnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def list_knowledge_bases( + self, + ) -> Callable[ + [knowledge_base.ListKnowledgeBasesRequest], + knowledge_base.ListKnowledgeBasesResponse, + ]: + r"""Return a callable for the list knowledge bases method over gRPC. + + Returns the list of all knowledge bases of the specified agent. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Returns: + Callable[[~.ListKnowledgeBasesRequest], + ~.ListKnowledgeBasesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_knowledge_bases" not in self._stubs: + self._stubs["list_knowledge_bases"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.KnowledgeBases/ListKnowledgeBases", + request_serializer=knowledge_base.ListKnowledgeBasesRequest.serialize, + response_deserializer=knowledge_base.ListKnowledgeBasesResponse.deserialize, + ) + return self._stubs["list_knowledge_bases"] + + @property + def get_knowledge_base( + self, + ) -> Callable[ + [knowledge_base.GetKnowledgeBaseRequest], knowledge_base.KnowledgeBase + ]: + r"""Return a callable for the get knowledge base method over gRPC. + + Retrieves the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Returns: + Callable[[~.GetKnowledgeBaseRequest], + ~.KnowledgeBase]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_knowledge_base" not in self._stubs: + self._stubs["get_knowledge_base"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.KnowledgeBases/GetKnowledgeBase", + request_serializer=knowledge_base.GetKnowledgeBaseRequest.serialize, + response_deserializer=knowledge_base.KnowledgeBase.deserialize, + ) + return self._stubs["get_knowledge_base"] + + @property + def create_knowledge_base( + self, + ) -> Callable[ + [gcd_knowledge_base.CreateKnowledgeBaseRequest], + gcd_knowledge_base.KnowledgeBase, + ]: + r"""Return a callable for the create knowledge base method over gRPC. + + Creates a knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Returns: + Callable[[~.CreateKnowledgeBaseRequest], + ~.KnowledgeBase]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_knowledge_base" not in self._stubs: + self._stubs["create_knowledge_base"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.KnowledgeBases/CreateKnowledgeBase", + request_serializer=gcd_knowledge_base.CreateKnowledgeBaseRequest.serialize, + response_deserializer=gcd_knowledge_base.KnowledgeBase.deserialize, + ) + return self._stubs["create_knowledge_base"] + + @property + def delete_knowledge_base( + self, + ) -> Callable[[knowledge_base.DeleteKnowledgeBaseRequest], empty.Empty]: + r"""Return a callable for the delete knowledge base method over gRPC. + + Deletes the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Returns: + Callable[[~.DeleteKnowledgeBaseRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_knowledge_base" not in self._stubs: + self._stubs["delete_knowledge_base"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.KnowledgeBases/DeleteKnowledgeBase", + request_serializer=knowledge_base.DeleteKnowledgeBaseRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_knowledge_base"] + + @property + def update_knowledge_base( + self, + ) -> Callable[ + [gcd_knowledge_base.UpdateKnowledgeBaseRequest], + gcd_knowledge_base.KnowledgeBase, + ]: + r"""Return a callable for the update knowledge base method over gRPC. + + Updates the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Returns: + Callable[[~.UpdateKnowledgeBaseRequest], + ~.KnowledgeBase]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_knowledge_base" not in self._stubs: + self._stubs["update_knowledge_base"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.KnowledgeBases/UpdateKnowledgeBase", + request_serializer=gcd_knowledge_base.UpdateKnowledgeBaseRequest.serialize, + response_deserializer=gcd_knowledge_base.KnowledgeBase.deserialize, + ) + return self._stubs["update_knowledge_base"] + + +__all__ = ("KnowledgeBasesGrpcTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/grpc_asyncio.py new file mode 100644 index 000000000..cd66435b8 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/knowledge_bases/transports/grpc_asyncio.py @@ -0,0 +1,397 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2beta1.types import knowledge_base +from google.cloud.dialogflow_v2beta1.types import knowledge_base as gcd_knowledge_base +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import KnowledgeBasesTransport, DEFAULT_CLIENT_INFO +from .grpc import KnowledgeBasesGrpcTransport + + +class KnowledgeBasesGrpcAsyncIOTransport(KnowledgeBasesTransport): + """gRPC AsyncIO backend transport for KnowledgeBases. + + Service for managing + [KnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def list_knowledge_bases( + self, + ) -> Callable[ + [knowledge_base.ListKnowledgeBasesRequest], + Awaitable[knowledge_base.ListKnowledgeBasesResponse], + ]: + r"""Return a callable for the list knowledge bases method over gRPC. + + Returns the list of all knowledge bases of the specified agent. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Returns: + Callable[[~.ListKnowledgeBasesRequest], + Awaitable[~.ListKnowledgeBasesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_knowledge_bases" not in self._stubs: + self._stubs["list_knowledge_bases"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.KnowledgeBases/ListKnowledgeBases", + request_serializer=knowledge_base.ListKnowledgeBasesRequest.serialize, + response_deserializer=knowledge_base.ListKnowledgeBasesResponse.deserialize, + ) + return self._stubs["list_knowledge_bases"] + + @property + def get_knowledge_base( + self, + ) -> Callable[ + [knowledge_base.GetKnowledgeBaseRequest], + Awaitable[knowledge_base.KnowledgeBase], + ]: + r"""Return a callable for the get knowledge base method over gRPC. + + Retrieves the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Returns: + Callable[[~.GetKnowledgeBaseRequest], + Awaitable[~.KnowledgeBase]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_knowledge_base" not in self._stubs: + self._stubs["get_knowledge_base"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.KnowledgeBases/GetKnowledgeBase", + request_serializer=knowledge_base.GetKnowledgeBaseRequest.serialize, + response_deserializer=knowledge_base.KnowledgeBase.deserialize, + ) + return self._stubs["get_knowledge_base"] + + @property + def create_knowledge_base( + self, + ) -> Callable[ + [gcd_knowledge_base.CreateKnowledgeBaseRequest], + Awaitable[gcd_knowledge_base.KnowledgeBase], + ]: + r"""Return a callable for the create knowledge base method over gRPC. + + Creates a knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Returns: + Callable[[~.CreateKnowledgeBaseRequest], + Awaitable[~.KnowledgeBase]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_knowledge_base" not in self._stubs: + self._stubs["create_knowledge_base"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.KnowledgeBases/CreateKnowledgeBase", + request_serializer=gcd_knowledge_base.CreateKnowledgeBaseRequest.serialize, + response_deserializer=gcd_knowledge_base.KnowledgeBase.deserialize, + ) + return self._stubs["create_knowledge_base"] + + @property + def delete_knowledge_base( + self, + ) -> Callable[[knowledge_base.DeleteKnowledgeBaseRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete knowledge base method over gRPC. + + Deletes the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Returns: + Callable[[~.DeleteKnowledgeBaseRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_knowledge_base" not in self._stubs: + self._stubs["delete_knowledge_base"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.KnowledgeBases/DeleteKnowledgeBase", + request_serializer=knowledge_base.DeleteKnowledgeBaseRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_knowledge_base"] + + @property + def update_knowledge_base( + self, + ) -> Callable[ + [gcd_knowledge_base.UpdateKnowledgeBaseRequest], + Awaitable[gcd_knowledge_base.KnowledgeBase], + ]: + r"""Return a callable for the update knowledge base method over gRPC. + + Updates the specified knowledge base. + + Note: The ``projects.agent.knowledgeBases`` resource is + deprecated; only use ``projects.knowledgeBases``. + + Returns: + Callable[[~.UpdateKnowledgeBaseRequest], + Awaitable[~.KnowledgeBase]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_knowledge_base" not in self._stubs: + self._stubs["update_knowledge_base"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.KnowledgeBases/UpdateKnowledgeBase", + request_serializer=gcd_knowledge_base.UpdateKnowledgeBaseRequest.serialize, + response_deserializer=gcd_knowledge_base.KnowledgeBase.deserialize, + ) + return self._stubs["update_knowledge_base"] + + +__all__ = ("KnowledgeBasesGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/session_entity_types/__init__.py b/google/cloud/dialogflow_v2beta1/services/session_entity_types/__init__.py new file mode 100644 index 000000000..c0dca267f --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/session_entity_types/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import SessionEntityTypesClient +from .async_client import SessionEntityTypesAsyncClient + +__all__ = ( + "SessionEntityTypesClient", + "SessionEntityTypesAsyncClient", +) diff --git a/google/cloud/dialogflow_v2beta1/services/session_entity_types/async_client.py b/google/cloud/dialogflow_v2beta1/services/session_entity_types/async_client.py new file mode 100644 index 000000000..b5443f69d --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/session_entity_types/async_client.py @@ -0,0 +1,631 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2beta1.services.session_entity_types import pagers +from google.cloud.dialogflow_v2beta1.types import entity_type +from google.cloud.dialogflow_v2beta1.types import session_entity_type +from google.cloud.dialogflow_v2beta1.types import ( + session_entity_type as gcd_session_entity_type, +) +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + +from .transports.base import SessionEntityTypesTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import SessionEntityTypesGrpcAsyncIOTransport +from .client import SessionEntityTypesClient + + +class SessionEntityTypesAsyncClient: + """Service for managing + [SessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityType]. + """ + + _client: SessionEntityTypesClient + + DEFAULT_ENDPOINT = SessionEntityTypesClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = SessionEntityTypesClient.DEFAULT_MTLS_ENDPOINT + + session_entity_type_path = staticmethod( + SessionEntityTypesClient.session_entity_type_path + ) + parse_session_entity_type_path = staticmethod( + SessionEntityTypesClient.parse_session_entity_type_path + ) + + common_billing_account_path = staticmethod( + SessionEntityTypesClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + SessionEntityTypesClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(SessionEntityTypesClient.common_folder_path) + parse_common_folder_path = staticmethod( + SessionEntityTypesClient.parse_common_folder_path + ) + + common_organization_path = staticmethod( + SessionEntityTypesClient.common_organization_path + ) + parse_common_organization_path = staticmethod( + SessionEntityTypesClient.parse_common_organization_path + ) + + common_project_path = staticmethod(SessionEntityTypesClient.common_project_path) + parse_common_project_path = staticmethod( + SessionEntityTypesClient.parse_common_project_path + ) + + common_location_path = staticmethod(SessionEntityTypesClient.common_location_path) + parse_common_location_path = staticmethod( + SessionEntityTypesClient.parse_common_location_path + ) + + from_service_account_file = SessionEntityTypesClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> SessionEntityTypesTransport: + """Return the transport used by the client instance. + + Returns: + SessionEntityTypesTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(SessionEntityTypesClient).get_transport_class, + type(SessionEntityTypesClient), + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, SessionEntityTypesTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the session entity types client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.SessionEntityTypesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = SessionEntityTypesClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def list_session_entity_types( + self, + request: session_entity_type.ListSessionEntityTypesRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListSessionEntityTypesAsyncPager: + r"""Returns the list of all session entity types in the + specified session. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.ListSessionEntityTypesRequest`): + The request object. The request message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. + parent (:class:`str`): + Required. The session to list all session entity types + from. Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListSessionEntityTypesAsyncPager: + The response message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = session_entity_type.ListSessionEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_session_entity_types, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def get_session_entity_type( + self, + request: session_entity_type.GetSessionEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> session_entity_type.SessionEntityType: + r"""Retrieves the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.GetSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType]. + name (:class:`str`): + Required. The name of the session entity type. Supported + formats: + + - ``projects//agent/sessions//entityTypes/`` + - ``projects//locations//agent/sessions//entityTypes/`` + - ``projects//agent/environments//users//sessions//entityTypes/`` + - ``projects//locations//agent/environments/ /users//sessions//entityTypes/`` + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = session_entity_type.GetSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_session_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_session_entity_type( + self, + request: gcd_session_entity_type.CreateSessionEntityTypeRequest = None, + *, + parent: str = None, + session_entity_type: gcd_session_entity_type.SessionEntityType = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session_entity_type.SessionEntityType: + r"""Creates a session entity type. + If the specified session entity type already exists, + overrides the session entity type. + + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.gcd_session_entity_type.CreateSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType]. + parent (:class:`str`): + Required. The session to create a session entity type + for. Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + session_entity_type (:class:`~.gcd_session_entity_type.SessionEntityType`): + Required. The session entity type to + create. + This corresponds to the ``session_entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, session_entity_type]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_session_entity_type.CreateSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if session_entity_type is not None: + request.session_entity_type = session_entity_type + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_session_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def update_session_entity_type( + self, + request: gcd_session_entity_type.UpdateSessionEntityTypeRequest = None, + *, + session_entity_type: gcd_session_entity_type.SessionEntityType = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session_entity_type.SessionEntityType: + r"""Updates the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.gcd_session_entity_type.UpdateSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType]. + session_entity_type (:class:`~.gcd_session_entity_type.SessionEntityType`): + Required. The session entity type to + update. + This corresponds to the ``session_entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([session_entity_type, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_session_entity_type.UpdateSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if session_entity_type is not None: + request.session_entity_type = session_entity_type + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_session_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("session_entity_type.name", request.session_entity_type.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_session_entity_type( + self, + request: session_entity_type.DeleteSessionEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.DeleteSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType]. + name (:class:`str`): + Required. The name of the entity type to delete. + Supported formats: + + - ``projects//agent/sessions//entityTypes/`` + - ``projects//locations//agent/sessions//entityTypes/`` + - ``projects//agent/environments//users//sessions//entityTypes/`` + - ``projects//locations//agent/environments/ /users//sessions//entityTypes/`` + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = session_entity_type.DeleteSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_session_entity_type, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("SessionEntityTypesAsyncClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/session_entity_types/client.py b/google/cloud/dialogflow_v2beta1/services/session_entity_types/client.py new file mode 100644 index 000000000..2a885ecc9 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/session_entity_types/client.py @@ -0,0 +1,836 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2beta1.services.session_entity_types import pagers +from google.cloud.dialogflow_v2beta1.types import entity_type +from google.cloud.dialogflow_v2beta1.types import session_entity_type +from google.cloud.dialogflow_v2beta1.types import ( + session_entity_type as gcd_session_entity_type, +) +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + +from .transports.base import SessionEntityTypesTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import SessionEntityTypesGrpcTransport +from .transports.grpc_asyncio import SessionEntityTypesGrpcAsyncIOTransport + + +class SessionEntityTypesClientMeta(type): + """Metaclass for the SessionEntityTypes client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[SessionEntityTypesTransport]] + _transport_registry["grpc"] = SessionEntityTypesGrpcTransport + _transport_registry["grpc_asyncio"] = SessionEntityTypesGrpcAsyncIOTransport + + def get_transport_class( + cls, label: str = None, + ) -> Type[SessionEntityTypesTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class SessionEntityTypesClient(metaclass=SessionEntityTypesClientMeta): + """Service for managing + [SessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityType]. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> SessionEntityTypesTransport: + """Return the transport used by the client instance. + + Returns: + SessionEntityTypesTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def session_entity_type_path(project: str, session: str, entity_type: str,) -> str: + """Return a fully-qualified session_entity_type string.""" + return "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}".format( + project=project, session=session, entity_type=entity_type, + ) + + @staticmethod + def parse_session_entity_type_path(path: str) -> Dict[str, str]: + """Parse a session_entity_type path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/entityTypes/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, SessionEntityTypesTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the session entity types client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.SessionEntityTypesTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, SessionEntityTypesTransport): + # transport is a SessionEntityTypesTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def list_session_entity_types( + self, + request: session_entity_type.ListSessionEntityTypesRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListSessionEntityTypesPager: + r"""Returns the list of all session entity types in the + specified session. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.ListSessionEntityTypesRequest`): + The request object. The request message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. + parent (:class:`str`): + Required. The session to list all session entity types + from. Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListSessionEntityTypesPager: + The response message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a session_entity_type.ListSessionEntityTypesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, session_entity_type.ListSessionEntityTypesRequest): + request = session_entity_type.ListSessionEntityTypesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.list_session_entity_types + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def get_session_entity_type( + self, + request: session_entity_type.GetSessionEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> session_entity_type.SessionEntityType: + r"""Retrieves the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.GetSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType]. + name (:class:`str`): + Required. The name of the session entity type. Supported + formats: + + - ``projects//agent/sessions//entityTypes/`` + - ``projects//locations//agent/sessions//entityTypes/`` + - ``projects//agent/environments//users//sessions//entityTypes/`` + - ``projects//locations//agent/environments/ /users//sessions//entityTypes/`` + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a session_entity_type.GetSessionEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, session_entity_type.GetSessionEntityTypeRequest): + request = session_entity_type.GetSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_session_entity_type] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_session_entity_type( + self, + request: gcd_session_entity_type.CreateSessionEntityTypeRequest = None, + *, + parent: str = None, + session_entity_type: gcd_session_entity_type.SessionEntityType = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session_entity_type.SessionEntityType: + r"""Creates a session entity type. + If the specified session entity type already exists, + overrides the session entity type. + + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.gcd_session_entity_type.CreateSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType]. + parent (:class:`str`): + Required. The session to create a session entity type + for. Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + session_entity_type (:class:`~.gcd_session_entity_type.SessionEntityType`): + Required. The session entity type to + create. + This corresponds to the ``session_entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, session_entity_type]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_session_entity_type.CreateSessionEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, gcd_session_entity_type.CreateSessionEntityTypeRequest + ): + request = gcd_session_entity_type.CreateSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if session_entity_type is not None: + request.session_entity_type = session_entity_type + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.create_session_entity_type + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def update_session_entity_type( + self, + request: gcd_session_entity_type.UpdateSessionEntityTypeRequest = None, + *, + session_entity_type: gcd_session_entity_type.SessionEntityType = None, + update_mask: field_mask.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session_entity_type.SessionEntityType: + r"""Updates the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.gcd_session_entity_type.UpdateSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType]. + session_entity_type (:class:`~.gcd_session_entity_type.SessionEntityType`): + Required. The session entity type to + update. + This corresponds to the ``session_entity_type`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`~.field_mask.FieldMask`): + Optional. The mask to control which + fields get updated. + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session_entity_type.SessionEntityType: + A session represents a conversation between a Dialogflow + agent and an end-user. You can create special entities, + called session entities, during a session. Session + entities can extend or replace custom entity types and + only exist during the session that they were created + for. All session data, including session entities, is + stored by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([session_entity_type, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_session_entity_type.UpdateSessionEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, gcd_session_entity_type.UpdateSessionEntityTypeRequest + ): + request = gcd_session_entity_type.UpdateSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if session_entity_type is not None: + request.session_entity_type = session_entity_type + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.update_session_entity_type + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("session_entity_type.name", request.session_entity_type.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_session_entity_type( + self, + request: session_entity_type.DeleteSessionEntityTypeRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Args: + request (:class:`~.session_entity_type.DeleteSessionEntityTypeRequest`): + The request object. The request message for + [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType]. + name (:class:`str`): + Required. The name of the entity type to delete. + Supported formats: + + - ``projects//agent/sessions//entityTypes/`` + - ``projects//locations//agent/sessions//entityTypes/`` + - ``projects//agent/environments//users//sessions//entityTypes/`` + - ``projects//locations//agent/environments/ /users//sessions//entityTypes/`` + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we assume default '-' user. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a session_entity_type.DeleteSessionEntityTypeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, session_entity_type.DeleteSessionEntityTypeRequest): + request = session_entity_type.DeleteSessionEntityTypeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.delete_session_entity_type + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("SessionEntityTypesClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/session_entity_types/pagers.py b/google/cloud/dialogflow_v2beta1/services/session_entity_types/pagers.py new file mode 100644 index 000000000..e883ae9e1 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/session_entity_types/pagers.py @@ -0,0 +1,152 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.dialogflow_v2beta1.types import session_entity_type + + +class ListSessionEntityTypesPager: + """A pager for iterating through ``list_session_entity_types`` requests. + + This class thinly wraps an initial + :class:`~.session_entity_type.ListSessionEntityTypesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``session_entity_types`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListSessionEntityTypes`` requests and continue to iterate + through the ``session_entity_types`` field on the + corresponding responses. + + All the usual :class:`~.session_entity_type.ListSessionEntityTypesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., session_entity_type.ListSessionEntityTypesResponse], + request: session_entity_type.ListSessionEntityTypesRequest, + response: session_entity_type.ListSessionEntityTypesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.session_entity_type.ListSessionEntityTypesRequest`): + The initial request object. + response (:class:`~.session_entity_type.ListSessionEntityTypesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = session_entity_type.ListSessionEntityTypesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[session_entity_type.ListSessionEntityTypesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[session_entity_type.SessionEntityType]: + for page in self.pages: + yield from page.session_entity_types + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListSessionEntityTypesAsyncPager: + """A pager for iterating through ``list_session_entity_types`` requests. + + This class thinly wraps an initial + :class:`~.session_entity_type.ListSessionEntityTypesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``session_entity_types`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListSessionEntityTypes`` requests and continue to iterate + through the ``session_entity_types`` field on the + corresponding responses. + + All the usual :class:`~.session_entity_type.ListSessionEntityTypesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[ + ..., Awaitable[session_entity_type.ListSessionEntityTypesResponse] + ], + request: session_entity_type.ListSessionEntityTypesRequest, + response: session_entity_type.ListSessionEntityTypesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.session_entity_type.ListSessionEntityTypesRequest`): + The initial request object. + response (:class:`~.session_entity_type.ListSessionEntityTypesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = session_entity_type.ListSessionEntityTypesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages( + self, + ) -> AsyncIterable[session_entity_type.ListSessionEntityTypesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[session_entity_type.SessionEntityType]: + async def async_generator(): + async for page in self.pages: + for response in page.session_entity_types: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/__init__.py b/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/__init__.py new file mode 100644 index 000000000..7ab5a895a --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/__init__.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import SessionEntityTypesTransport +from .grpc import SessionEntityTypesGrpcTransport +from .grpc_asyncio import SessionEntityTypesGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = ( + OrderedDict() +) # type: Dict[str, Type[SessionEntityTypesTransport]] +_transport_registry["grpc"] = SessionEntityTypesGrpcTransport +_transport_registry["grpc_asyncio"] = SessionEntityTypesGrpcAsyncIOTransport + + +__all__ = ( + "SessionEntityTypesTransport", + "SessionEntityTypesGrpcTransport", + "SessionEntityTypesGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/base.py b/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/base.py new file mode 100644 index 000000000..574b6c1e4 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/base.py @@ -0,0 +1,201 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2beta1.types import session_entity_type +from google.cloud.dialogflow_v2beta1.types import ( + session_entity_type as gcd_session_entity_type, +) +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class SessionEntityTypesTransport(abc.ABC): + """Abstract transport class for SessionEntityTypes.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_session_entity_types: gapic_v1.method.wrap_method( + self.list_session_entity_types, + default_timeout=None, + client_info=client_info, + ), + self.get_session_entity_type: gapic_v1.method.wrap_method( + self.get_session_entity_type, + default_timeout=None, + client_info=client_info, + ), + self.create_session_entity_type: gapic_v1.method.wrap_method( + self.create_session_entity_type, + default_timeout=None, + client_info=client_info, + ), + self.update_session_entity_type: gapic_v1.method.wrap_method( + self.update_session_entity_type, + default_timeout=None, + client_info=client_info, + ), + self.delete_session_entity_type: gapic_v1.method.wrap_method( + self.delete_session_entity_type, + default_timeout=None, + client_info=client_info, + ), + } + + @property + def list_session_entity_types( + self, + ) -> typing.Callable[ + [session_entity_type.ListSessionEntityTypesRequest], + typing.Union[ + session_entity_type.ListSessionEntityTypesResponse, + typing.Awaitable[session_entity_type.ListSessionEntityTypesResponse], + ], + ]: + raise NotImplementedError() + + @property + def get_session_entity_type( + self, + ) -> typing.Callable[ + [session_entity_type.GetSessionEntityTypeRequest], + typing.Union[ + session_entity_type.SessionEntityType, + typing.Awaitable[session_entity_type.SessionEntityType], + ], + ]: + raise NotImplementedError() + + @property + def create_session_entity_type( + self, + ) -> typing.Callable[ + [gcd_session_entity_type.CreateSessionEntityTypeRequest], + typing.Union[ + gcd_session_entity_type.SessionEntityType, + typing.Awaitable[gcd_session_entity_type.SessionEntityType], + ], + ]: + raise NotImplementedError() + + @property + def update_session_entity_type( + self, + ) -> typing.Callable[ + [gcd_session_entity_type.UpdateSessionEntityTypeRequest], + typing.Union[ + gcd_session_entity_type.SessionEntityType, + typing.Awaitable[gcd_session_entity_type.SessionEntityType], + ], + ]: + raise NotImplementedError() + + @property + def delete_session_entity_type( + self, + ) -> typing.Callable[ + [session_entity_type.DeleteSessionEntityTypeRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + +__all__ = ("SessionEntityTypesTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/grpc.py b/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/grpc.py new file mode 100644 index 000000000..dc8b587ad --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/grpc.py @@ -0,0 +1,399 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2beta1.types import session_entity_type +from google.cloud.dialogflow_v2beta1.types import ( + session_entity_type as gcd_session_entity_type, +) +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import SessionEntityTypesTransport, DEFAULT_CLIENT_INFO + + +class SessionEntityTypesGrpcTransport(SessionEntityTypesTransport): + """gRPC backend transport for SessionEntityTypes. + + Service for managing + [SessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityType]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def list_session_entity_types( + self, + ) -> Callable[ + [session_entity_type.ListSessionEntityTypesRequest], + session_entity_type.ListSessionEntityTypesResponse, + ]: + r"""Return a callable for the list session entity types method over gRPC. + + Returns the list of all session entity types in the + specified session. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.ListSessionEntityTypesRequest], + ~.ListSessionEntityTypesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_session_entity_types" not in self._stubs: + self._stubs["list_session_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/ListSessionEntityTypes", + request_serializer=session_entity_type.ListSessionEntityTypesRequest.serialize, + response_deserializer=session_entity_type.ListSessionEntityTypesResponse.deserialize, + ) + return self._stubs["list_session_entity_types"] + + @property + def get_session_entity_type( + self, + ) -> Callable[ + [session_entity_type.GetSessionEntityTypeRequest], + session_entity_type.SessionEntityType, + ]: + r"""Return a callable for the get session entity type method over gRPC. + + Retrieves the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.GetSessionEntityTypeRequest], + ~.SessionEntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_session_entity_type" not in self._stubs: + self._stubs["get_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/GetSessionEntityType", + request_serializer=session_entity_type.GetSessionEntityTypeRequest.serialize, + response_deserializer=session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["get_session_entity_type"] + + @property + def create_session_entity_type( + self, + ) -> Callable[ + [gcd_session_entity_type.CreateSessionEntityTypeRequest], + gcd_session_entity_type.SessionEntityType, + ]: + r"""Return a callable for the create session entity type method over gRPC. + + Creates a session entity type. + If the specified session entity type already exists, + overrides the session entity type. + + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.CreateSessionEntityTypeRequest], + ~.SessionEntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_session_entity_type" not in self._stubs: + self._stubs["create_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/CreateSessionEntityType", + request_serializer=gcd_session_entity_type.CreateSessionEntityTypeRequest.serialize, + response_deserializer=gcd_session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["create_session_entity_type"] + + @property + def update_session_entity_type( + self, + ) -> Callable[ + [gcd_session_entity_type.UpdateSessionEntityTypeRequest], + gcd_session_entity_type.SessionEntityType, + ]: + r"""Return a callable for the update session entity type method over gRPC. + + Updates the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.UpdateSessionEntityTypeRequest], + ~.SessionEntityType]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_session_entity_type" not in self._stubs: + self._stubs["update_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/UpdateSessionEntityType", + request_serializer=gcd_session_entity_type.UpdateSessionEntityTypeRequest.serialize, + response_deserializer=gcd_session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["update_session_entity_type"] + + @property + def delete_session_entity_type( + self, + ) -> Callable[[session_entity_type.DeleteSessionEntityTypeRequest], empty.Empty]: + r"""Return a callable for the delete session entity type method over gRPC. + + Deletes the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.DeleteSessionEntityTypeRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_session_entity_type" not in self._stubs: + self._stubs["delete_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/DeleteSessionEntityType", + request_serializer=session_entity_type.DeleteSessionEntityTypeRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_session_entity_type"] + + +__all__ = ("SessionEntityTypesGrpcTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/grpc_asyncio.py new file mode 100644 index 000000000..421e63326 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/session_entity_types/transports/grpc_asyncio.py @@ -0,0 +1,405 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2beta1.types import session_entity_type +from google.cloud.dialogflow_v2beta1.types import ( + session_entity_type as gcd_session_entity_type, +) +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import SessionEntityTypesTransport, DEFAULT_CLIENT_INFO +from .grpc import SessionEntityTypesGrpcTransport + + +class SessionEntityTypesGrpcAsyncIOTransport(SessionEntityTypesTransport): + """gRPC AsyncIO backend transport for SessionEntityTypes. + + Service for managing + [SessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityType]. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def list_session_entity_types( + self, + ) -> Callable[ + [session_entity_type.ListSessionEntityTypesRequest], + Awaitable[session_entity_type.ListSessionEntityTypesResponse], + ]: + r"""Return a callable for the list session entity types method over gRPC. + + Returns the list of all session entity types in the + specified session. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.ListSessionEntityTypesRequest], + Awaitable[~.ListSessionEntityTypesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_session_entity_types" not in self._stubs: + self._stubs["list_session_entity_types"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/ListSessionEntityTypes", + request_serializer=session_entity_type.ListSessionEntityTypesRequest.serialize, + response_deserializer=session_entity_type.ListSessionEntityTypesResponse.deserialize, + ) + return self._stubs["list_session_entity_types"] + + @property + def get_session_entity_type( + self, + ) -> Callable[ + [session_entity_type.GetSessionEntityTypeRequest], + Awaitable[session_entity_type.SessionEntityType], + ]: + r"""Return a callable for the get session entity type method over gRPC. + + Retrieves the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.GetSessionEntityTypeRequest], + Awaitable[~.SessionEntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_session_entity_type" not in self._stubs: + self._stubs["get_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/GetSessionEntityType", + request_serializer=session_entity_type.GetSessionEntityTypeRequest.serialize, + response_deserializer=session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["get_session_entity_type"] + + @property + def create_session_entity_type( + self, + ) -> Callable[ + [gcd_session_entity_type.CreateSessionEntityTypeRequest], + Awaitable[gcd_session_entity_type.SessionEntityType], + ]: + r"""Return a callable for the create session entity type method over gRPC. + + Creates a session entity type. + If the specified session entity type already exists, + overrides the session entity type. + + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.CreateSessionEntityTypeRequest], + Awaitable[~.SessionEntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_session_entity_type" not in self._stubs: + self._stubs["create_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/CreateSessionEntityType", + request_serializer=gcd_session_entity_type.CreateSessionEntityTypeRequest.serialize, + response_deserializer=gcd_session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["create_session_entity_type"] + + @property + def update_session_entity_type( + self, + ) -> Callable[ + [gcd_session_entity_type.UpdateSessionEntityTypeRequest], + Awaitable[gcd_session_entity_type.SessionEntityType], + ]: + r"""Return a callable for the update session entity type method over gRPC. + + Updates the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.UpdateSessionEntityTypeRequest], + Awaitable[~.SessionEntityType]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_session_entity_type" not in self._stubs: + self._stubs["update_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/UpdateSessionEntityType", + request_serializer=gcd_session_entity_type.UpdateSessionEntityTypeRequest.serialize, + response_deserializer=gcd_session_entity_type.SessionEntityType.deserialize, + ) + return self._stubs["update_session_entity_type"] + + @property + def delete_session_entity_type( + self, + ) -> Callable[ + [session_entity_type.DeleteSessionEntityTypeRequest], Awaitable[empty.Empty] + ]: + r"""Return a callable for the delete session entity type method over gRPC. + + Deletes the specified session entity type. + This method doesn't work with Google Assistant + integration. Contact Dialogflow support if you need to + use session entities with Google Assistant integration. + + Returns: + Callable[[~.DeleteSessionEntityTypeRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_session_entity_type" not in self._stubs: + self._stubs["delete_session_entity_type"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.SessionEntityTypes/DeleteSessionEntityType", + request_serializer=session_entity_type.DeleteSessionEntityTypeRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_session_entity_type"] + + +__all__ = ("SessionEntityTypesGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/sessions/__init__.py b/google/cloud/dialogflow_v2beta1/services/sessions/__init__.py new file mode 100644 index 000000000..3b2a59a9d --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/sessions/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .client import SessionsClient +from .async_client import SessionsAsyncClient + +__all__ = ( + "SessionsClient", + "SessionsAsyncClient", +) diff --git a/google/cloud/dialogflow_v2beta1/services/sessions/async_client.py b/google/cloud/dialogflow_v2beta1/services/sessions/async_client.py new file mode 100644 index 000000000..2d9cd4bf1 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/sessions/async_client.py @@ -0,0 +1,394 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +import functools +import re +from typing import ( + Dict, + AsyncIterable, + Awaitable, + AsyncIterator, + Sequence, + Tuple, + Type, + Union, +) +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2beta1.types import audio_config +from google.cloud.dialogflow_v2beta1.types import session +from google.cloud.dialogflow_v2beta1.types import session as gcd_session +from google.rpc import status_pb2 as status # type: ignore + +from .transports.base import SessionsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import SessionsGrpcAsyncIOTransport +from .client import SessionsClient + + +class SessionsAsyncClient: + """A service used for session interactions. + + For more information, see the `API interactions + guide `__. + """ + + _client: SessionsClient + + DEFAULT_ENDPOINT = SessionsClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = SessionsClient.DEFAULT_MTLS_ENDPOINT + + context_path = staticmethod(SessionsClient.context_path) + parse_context_path = staticmethod(SessionsClient.parse_context_path) + document_path = staticmethod(SessionsClient.document_path) + parse_document_path = staticmethod(SessionsClient.parse_document_path) + intent_path = staticmethod(SessionsClient.intent_path) + parse_intent_path = staticmethod(SessionsClient.parse_intent_path) + session_path = staticmethod(SessionsClient.session_path) + parse_session_path = staticmethod(SessionsClient.parse_session_path) + session_entity_type_path = staticmethod(SessionsClient.session_entity_type_path) + parse_session_entity_type_path = staticmethod( + SessionsClient.parse_session_entity_type_path + ) + + common_billing_account_path = staticmethod( + SessionsClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + SessionsClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(SessionsClient.common_folder_path) + parse_common_folder_path = staticmethod(SessionsClient.parse_common_folder_path) + + common_organization_path = staticmethod(SessionsClient.common_organization_path) + parse_common_organization_path = staticmethod( + SessionsClient.parse_common_organization_path + ) + + common_project_path = staticmethod(SessionsClient.common_project_path) + parse_common_project_path = staticmethod(SessionsClient.parse_common_project_path) + + common_location_path = staticmethod(SessionsClient.common_location_path) + parse_common_location_path = staticmethod(SessionsClient.parse_common_location_path) + + from_service_account_file = SessionsClient.from_service_account_file + from_service_account_json = from_service_account_file + + @property + def transport(self) -> SessionsTransport: + """Return the transport used by the client instance. + + Returns: + SessionsTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial( + type(SessionsClient).get_transport_class, type(SessionsClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, SessionsTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the sessions client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.SessionsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = SessionsClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + ) + + async def detect_intent( + self, + request: gcd_session.DetectIntentRequest = None, + *, + session: str = None, + query_input: gcd_session.QueryInput = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session.DetectIntentResponse: + r"""Processes a natural language query and returns structured, + actionable data as a result. This method is not idempotent, + because it may cause contexts and session entity types to be + updated, which in turn might affect results of future queries. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Args: + request (:class:`~.gcd_session.DetectIntentRequest`): + The request object. The request to detect user's intent. + session (:class:`str`): + Required. The name of the session this query is sent to. + Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we are using "-". It's up to the API + caller to choose an appropriate ``Session ID`` and + ``User Id``. They can be a random number or some type of + user and session identifiers (preferably hashed). The + length of the ``Session ID`` and ``User ID`` must not + exceed 36 characters. For more information, see the `API + interactions + guide `__. + + Note: Always use agent versions for production traffic. + See `Versions and + environments `__. + This corresponds to the ``session`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + query_input (:class:`~.gcd_session.QueryInput`): + Required. The input specification. It + can be set to: + 1. an audio config + which instructs the speech + recognizer how to process the speech + audio, + 2. a conversational query in the form + of text, or + 3. an event that specifies which intent + to trigger. + This corresponds to the ``query_input`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session.DetectIntentResponse: + The message returned from the + DetectIntent method. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([session, query_input]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gcd_session.DetectIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if session is not None: + request.session = session + if query_input is not None: + request.query_input = query_input + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.detect_intent, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), + ), + default_timeout=220.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("session", request.session),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def streaming_detect_intent( + self, + requests: AsyncIterator[session.StreamingDetectIntentRequest] = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> Awaitable[AsyncIterable[session.StreamingDetectIntentResponse]]: + r"""Processes a natural language query in audio format in a + streaming fashion and returns structured, actionable data as a + result. This method is only available via the gRPC API (not + REST). + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Args: + requests (AsyncIterator[`~.session.StreamingDetectIntentRequest`]): + The request object AsyncIterator. The top-level message sent by the + client to the + [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent] + method. + Multiple request messages should be sent in order: + + 1. The first message must contain + [session][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.session], + [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] + plus optionally + [query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. + If the client wants to receive an audio response, it + should also contain + [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config]. + The message must not contain + [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio]. + 2. If + [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] + was set to + [query_input.audio_config][google.cloud.dialogflow.v2beta1.InputAudioConfig], + all subsequent messages must contain + [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio] + to continue with Speech recognition. + If you decide to rather detect an intent from text + input after you already started Speech recognition, + please send a message with + [query_input.text][google.cloud.dialogflow.v2beta1.QueryInput.text]. + However, note that: + + * Dialogflow will bill you for the audio duration so + far. * Dialogflow discards all Speech recognition + results in favor of the input text. + * Dialogflow will use the language code from the + first message. + After you sent all input, you must half-close or abort + the request stream. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + AsyncIterable[~.session.StreamingDetectIntentResponse]: + The top-level message returned from the + ``StreamingDetectIntent`` method. + + Multiple response messages can be returned in order: + + 1. If the input was set to streaming audio, the first + one or more messages contain ``recognition_result``. + Each ``recognition_result`` represents a more + complete transcript of what the user said. The last + ``recognition_result`` has ``is_final`` set to + ``true``. + + 2. The next message contains ``response_id``, + ``query_result``, ``alternative_query_results`` and + optionally ``webhook_status`` if a WebHook was + called. + + 3. If ``output_audio_config`` was specified in the + request or agent-level speech synthesizer is + configured, all subsequent messages contain + ``output_audio`` and ``output_audio_config``. + + """ + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.streaming_detect_intent, + default_timeout=220.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Send the request. + response = rpc(requests, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("SessionsAsyncClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/sessions/client.py b/google/cloud/dialogflow_v2beta1/services/sessions/client.py new file mode 100644 index 000000000..14689e32b --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/sessions/client.py @@ -0,0 +1,633 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from distutils import util +import os +import re +from typing import ( + Callable, + Dict, + Optional, + Iterable, + Iterator, + Sequence, + Tuple, + Type, + Union, +) +import pkg_resources + +from google.api_core import client_options as client_options_lib # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.dialogflow_v2beta1.types import audio_config +from google.cloud.dialogflow_v2beta1.types import session +from google.cloud.dialogflow_v2beta1.types import session as gcd_session +from google.rpc import status_pb2 as status # type: ignore + +from .transports.base import SessionsTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import SessionsGrpcTransport +from .transports.grpc_asyncio import SessionsGrpcAsyncIOTransport + + +class SessionsClientMeta(type): + """Metaclass for the Sessions client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[SessionsTransport]] + _transport_registry["grpc"] = SessionsGrpcTransport + _transport_registry["grpc_asyncio"] = SessionsGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[SessionsTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class SessionsClient(metaclass=SessionsClientMeta): + """A service used for session interactions. + + For more information, see the `API interactions + guide `__. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "dialogflow.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> SessionsTransport: + """Return the transport used by the client instance. + + Returns: + SessionsTransport: The transport used by the client instance. + """ + return self._transport + + @staticmethod + def context_path(project: str, session: str, context: str,) -> str: + """Return a fully-qualified context string.""" + return "projects/{project}/agent/sessions/{session}/contexts/{context}".format( + project=project, session=session, context=context, + ) + + @staticmethod + def parse_context_path(path: str) -> Dict[str, str]: + """Parse a context path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/contexts/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def document_path(project: str, knowledge_base: str, document: str,) -> str: + """Return a fully-qualified document string.""" + return "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}".format( + project=project, knowledge_base=knowledge_base, document=document, + ) + + @staticmethod + def parse_document_path(path: str) -> Dict[str, str]: + """Parse a document path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/knowledgeBases/(?P.+?)/documents/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def intent_path(project: str, intent: str,) -> str: + """Return a fully-qualified intent string.""" + return "projects/{project}/agent/intents/{intent}".format( + project=project, intent=intent, + ) + + @staticmethod + def parse_intent_path(path: str) -> Dict[str, str]: + """Parse a intent path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/agent/intents/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def session_path(project: str, session: str,) -> str: + """Return a fully-qualified session string.""" + return "projects/{project}/agent/sessions/{session}".format( + project=project, session=session, + ) + + @staticmethod + def parse_session_path(path: str) -> Dict[str, str]: + """Parse a session path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)$", path + ) + return m.groupdict() if m else {} + + @staticmethod + def session_entity_type_path(project: str, session: str, entity_type: str,) -> str: + """Return a fully-qualified session_entity_type string.""" + return "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}".format( + project=project, session=session, entity_type=entity_type, + ) + + @staticmethod + def parse_session_entity_type_path(path: str) -> Dict[str, str]: + """Parse a session_entity_type path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/entityTypes/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, SessionsTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the sessions client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.SessionsTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + # Create SSL credentials for mutual TLS if needed. + use_client_cert = bool( + util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + ) + + ssl_credentials = None + is_mtls = False + if use_client_cert: + if client_options.client_cert_source: + import grpc # type: ignore + + cert, key = client_options.client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + is_mtls = True + else: + creds = SslCredentials() + is_mtls = creds.is_mtls + ssl_credentials = creds.ssl_credentials if is_mtls else None + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + else: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_mtls_env == "never": + api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, SessionsTransport): + # transport is a SessionsTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + ssl_channel_credentials=ssl_credentials, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + ) + + def detect_intent( + self, + request: gcd_session.DetectIntentRequest = None, + *, + session: str = None, + query_input: gcd_session.QueryInput = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gcd_session.DetectIntentResponse: + r"""Processes a natural language query and returns structured, + actionable data as a result. This method is not idempotent, + because it may cause contexts and session entity types to be + updated, which in turn might affect results of future queries. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Args: + request (:class:`~.gcd_session.DetectIntentRequest`): + The request object. The request to detect user's intent. + session (:class:`str`): + Required. The name of the session this query is sent to. + Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default + 'us' location. If ``Environment ID`` is not specified, + we assume default 'draft' environment. If ``User ID`` is + not specified, we are using "-". It's up to the API + caller to choose an appropriate ``Session ID`` and + ``User Id``. They can be a random number or some type of + user and session identifiers (preferably hashed). The + length of the ``Session ID`` and ``User ID`` must not + exceed 36 characters. For more information, see the `API + interactions + guide `__. + + Note: Always use agent versions for production traffic. + See `Versions and + environments `__. + This corresponds to the ``session`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + query_input (:class:`~.gcd_session.QueryInput`): + Required. The input specification. It + can be set to: + 1. an audio config + which instructs the speech + recognizer how to process the speech + audio, + 2. a conversational query in the form + of text, or + 3. an event that specifies which intent + to trigger. + This corresponds to the ``query_input`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gcd_session.DetectIntentResponse: + The message returned from the + DetectIntent method. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([session, query_input]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gcd_session.DetectIntentRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gcd_session.DetectIntentRequest): + request = gcd_session.DetectIntentRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if session is not None: + request.session = session + if query_input is not None: + request.query_input = query_input + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.detect_intent] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("session", request.session),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def streaming_detect_intent( + self, + requests: Iterator[session.StreamingDetectIntentRequest] = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> Iterable[session.StreamingDetectIntentResponse]: + r"""Processes a natural language query in audio format in a + streaming fashion and returns structured, actionable data as a + result. This method is only available via the gRPC API (not + REST). + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Args: + requests (Iterator[`~.session.StreamingDetectIntentRequest`]): + The request object iterator. The top-level message sent by the + client to the + [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent] + method. + Multiple request messages should be sent in order: + + 1. The first message must contain + [session][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.session], + [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] + plus optionally + [query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. + If the client wants to receive an audio response, it + should also contain + [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config]. + The message must not contain + [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio]. + 2. If + [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] + was set to + [query_input.audio_config][google.cloud.dialogflow.v2beta1.InputAudioConfig], + all subsequent messages must contain + [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio] + to continue with Speech recognition. + If you decide to rather detect an intent from text + input after you already started Speech recognition, + please send a message with + [query_input.text][google.cloud.dialogflow.v2beta1.QueryInput.text]. + However, note that: + + * Dialogflow will bill you for the audio duration so + far. * Dialogflow discards all Speech recognition + results in favor of the input text. + * Dialogflow will use the language code from the + first message. + After you sent all input, you must half-close or abort + the request stream. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + Iterable[~.session.StreamingDetectIntentResponse]: + The top-level message returned from the + ``StreamingDetectIntent`` method. + + Multiple response messages can be returned in order: + + 1. If the input was set to streaming audio, the first + one or more messages contain ``recognition_result``. + Each ``recognition_result`` represents a more + complete transcript of what the user said. The last + ``recognition_result`` has ``is_final`` set to + ``true``. + + 2. The next message contains ``response_id``, + ``query_result``, ``alternative_query_results`` and + optionally ``webhook_status`` if a WebHook was + called. + + 3. If ``output_audio_config`` was specified in the + request or agent-level speech synthesizer is + configured, all subsequent messages contain + ``output_audio`` and ``output_audio_config``. + + """ + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.streaming_detect_intent] + + # Send the request. + response = rpc(requests, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ("SessionsClient",) diff --git a/google/cloud/dialogflow_v2beta1/services/sessions/transports/__init__.py b/google/cloud/dialogflow_v2beta1/services/sessions/transports/__init__.py new file mode 100644 index 000000000..1e1b2a5e7 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/sessions/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import SessionsTransport +from .grpc import SessionsGrpcTransport +from .grpc_asyncio import SessionsGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[SessionsTransport]] +_transport_registry["grpc"] = SessionsGrpcTransport +_transport_registry["grpc_asyncio"] = SessionsGrpcAsyncIOTransport + + +__all__ = ( + "SessionsTransport", + "SessionsGrpcTransport", + "SessionsGrpcAsyncIOTransport", +) diff --git a/google/cloud/dialogflow_v2beta1/services/sessions/transports/base.py b/google/cloud/dialogflow_v2beta1/services/sessions/transports/base.py new file mode 100644 index 000000000..847196c05 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/sessions/transports/base.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import abc +import typing +import pkg_resources + +from google import auth # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.dialogflow_v2beta1.types import session +from google.cloud.dialogflow_v2beta1.types import session as gcd_session + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-dialogflow", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class SessionsTransport(abc.ABC): + """Abstract transport class for Sessions.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/dialogflow", + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages(client_info) + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.detect_intent: gapic_v1.method.wrap_method( + self.detect_intent, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), + ), + default_timeout=220.0, + client_info=client_info, + ), + self.streaming_detect_intent: gapic_v1.method.wrap_method( + self.streaming_detect_intent, + default_timeout=220.0, + client_info=client_info, + ), + } + + @property + def detect_intent( + self, + ) -> typing.Callable[ + [gcd_session.DetectIntentRequest], + typing.Union[ + gcd_session.DetectIntentResponse, + typing.Awaitable[gcd_session.DetectIntentResponse], + ], + ]: + raise NotImplementedError() + + @property + def streaming_detect_intent( + self, + ) -> typing.Callable[ + [session.StreamingDetectIntentRequest], + typing.Union[ + session.StreamingDetectIntentResponse, + typing.Awaitable[session.StreamingDetectIntentResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("SessionsTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/sessions/transports/grpc.py b/google/cloud/dialogflow_v2beta1/services/sessions/transports/grpc.py new file mode 100644 index 000000000..906d23f79 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/sessions/transports/grpc.py @@ -0,0 +1,305 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.dialogflow_v2beta1.types import session +from google.cloud.dialogflow_v2beta1.types import session as gcd_session + +from .base import SessionsTransport, DEFAULT_CLIENT_INFO + + +class SessionsGrpcTransport(SessionsTransport): + """gRPC backend transport for Sessions. + + A service used for session interactions. + + For more information, see the `API interactions + guide `__. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def detect_intent( + self, + ) -> Callable[[gcd_session.DetectIntentRequest], gcd_session.DetectIntentResponse]: + r"""Return a callable for the detect intent method over gRPC. + + Processes a natural language query and returns structured, + actionable data as a result. This method is not idempotent, + because it may cause contexts and session entity types to be + updated, which in turn might affect results of future queries. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Returns: + Callable[[~.DetectIntentRequest], + ~.DetectIntentResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "detect_intent" not in self._stubs: + self._stubs["detect_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Sessions/DetectIntent", + request_serializer=gcd_session.DetectIntentRequest.serialize, + response_deserializer=gcd_session.DetectIntentResponse.deserialize, + ) + return self._stubs["detect_intent"] + + @property + def streaming_detect_intent( + self, + ) -> Callable[ + [session.StreamingDetectIntentRequest], session.StreamingDetectIntentResponse + ]: + r"""Return a callable for the streaming detect intent method over gRPC. + + Processes a natural language query in audio format in a + streaming fashion and returns structured, actionable data as a + result. This method is only available via the gRPC API (not + REST). + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Returns: + Callable[[~.StreamingDetectIntentRequest], + ~.StreamingDetectIntentResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "streaming_detect_intent" not in self._stubs: + self._stubs["streaming_detect_intent"] = self.grpc_channel.stream_stream( + "/google.cloud.dialogflow.v2beta1.Sessions/StreamingDetectIntent", + request_serializer=session.StreamingDetectIntentRequest.serialize, + response_deserializer=session.StreamingDetectIntentResponse.deserialize, + ) + return self._stubs["streaming_detect_intent"] + + +__all__ = ("SessionsGrpcTransport",) diff --git a/google/cloud/dialogflow_v2beta1/services/sessions/transports/grpc_asyncio.py b/google/cloud/dialogflow_v2beta1/services/sessions/transports/grpc_asyncio.py new file mode 100644 index 000000000..fa589e891 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/services/sessions/transports/grpc_asyncio.py @@ -0,0 +1,312 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers_async # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.dialogflow_v2beta1.types import session +from google.cloud.dialogflow_v2beta1.types import session as gcd_session + +from .base import SessionsTransport, DEFAULT_CLIENT_INFO +from .grpc import SessionsGrpcTransport + + +class SessionsGrpcAsyncIOTransport(SessionsTransport): + """gRPC AsyncIO backend transport for Sessions. + + A service used for session interactions. + + For more information, see the `API interactions + guide `__. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "dialogflow.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for grpc channel. It is ignored if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._ssl_channel_credentials = ssl_channel_credentials + + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + elif api_mtls_endpoint: + warnings.warn( + "api_mtls_endpoint and client_cert_source are deprecated", + DeprecationWarning, + ) + + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + self._ssl_channel_credentials = ssl_credentials + else: + host = host if ":" in host else host + ":443" + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_channel_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + client_info=client_info, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def detect_intent( + self, + ) -> Callable[ + [gcd_session.DetectIntentRequest], Awaitable[gcd_session.DetectIntentResponse] + ]: + r"""Return a callable for the detect intent method over gRPC. + + Processes a natural language query and returns structured, + actionable data as a result. This method is not idempotent, + because it may cause contexts and session entity types to be + updated, which in turn might affect results of future queries. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Returns: + Callable[[~.DetectIntentRequest], + Awaitable[~.DetectIntentResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "detect_intent" not in self._stubs: + self._stubs["detect_intent"] = self.grpc_channel.unary_unary( + "/google.cloud.dialogflow.v2beta1.Sessions/DetectIntent", + request_serializer=gcd_session.DetectIntentRequest.serialize, + response_deserializer=gcd_session.DetectIntentResponse.deserialize, + ) + return self._stubs["detect_intent"] + + @property + def streaming_detect_intent( + self, + ) -> Callable[ + [session.StreamingDetectIntentRequest], + Awaitable[session.StreamingDetectIntentResponse], + ]: + r"""Return a callable for the streaming detect intent method over gRPC. + + Processes a natural language query in audio format in a + streaming fashion and returns structured, actionable data as a + result. This method is only available via the gRPC API (not + REST). + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + + Returns: + Callable[[~.StreamingDetectIntentRequest], + Awaitable[~.StreamingDetectIntentResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "streaming_detect_intent" not in self._stubs: + self._stubs["streaming_detect_intent"] = self.grpc_channel.stream_stream( + "/google.cloud.dialogflow.v2beta1.Sessions/StreamingDetectIntent", + request_serializer=session.StreamingDetectIntentRequest.serialize, + response_deserializer=session.StreamingDetectIntentResponse.deserialize, + ) + return self._stubs["streaming_detect_intent"] + + +__all__ = ("SessionsGrpcAsyncIOTransport",) diff --git a/google/cloud/dialogflow_v2beta1/types/__init__.py b/google/cloud/dialogflow_v2beta1/types/__init__.py new file mode 100644 index 000000000..2efb3d681 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/__init__.py @@ -0,0 +1,243 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +from .audio_config import ( + SpeechContext, + SpeechWordInfo, + InputAudioConfig, + VoiceSelectionParams, + SynthesizeSpeechConfig, + OutputAudioConfig, + TelephonyDtmfEvents, +) +from .environment import ( + Environment, + ListEnvironmentsRequest, + ListEnvironmentsResponse, +) +from .validation_result import ( + ValidationError, + ValidationResult, +) +from .agent import ( + Agent, + GetAgentRequest, + SetAgentRequest, + DeleteAgentRequest, + SubAgent, + SearchAgentsRequest, + SearchAgentsResponse, + TrainAgentRequest, + ExportAgentRequest, + ExportAgentResponse, + ImportAgentRequest, + RestoreAgentRequest, + GetValidationResultRequest, +) +from .context import ( + Context, + ListContextsRequest, + ListContextsResponse, + GetContextRequest, + CreateContextRequest, + UpdateContextRequest, + DeleteContextRequest, + DeleteAllContextsRequest, +) +from .gcs import GcsSource +from .document import ( + Document, + GetDocumentRequest, + ListDocumentsRequest, + ListDocumentsResponse, + CreateDocumentRequest, + DeleteDocumentRequest, + UpdateDocumentRequest, + KnowledgeOperationMetadata, + ReloadDocumentRequest, +) +from .entity_type import ( + EntityType, + ListEntityTypesRequest, + ListEntityTypesResponse, + GetEntityTypeRequest, + CreateEntityTypeRequest, + UpdateEntityTypeRequest, + DeleteEntityTypeRequest, + BatchUpdateEntityTypesRequest, + BatchUpdateEntityTypesResponse, + BatchDeleteEntityTypesRequest, + BatchCreateEntitiesRequest, + BatchUpdateEntitiesRequest, + BatchDeleteEntitiesRequest, + EntityTypeBatch, +) +from .intent import ( + Intent, + ListIntentsRequest, + ListIntentsResponse, + GetIntentRequest, + CreateIntentRequest, + UpdateIntentRequest, + DeleteIntentRequest, + BatchUpdateIntentsRequest, + BatchUpdateIntentsResponse, + BatchDeleteIntentsRequest, + IntentBatch, +) +from .knowledge_base import ( + KnowledgeBase, + ListKnowledgeBasesRequest, + ListKnowledgeBasesResponse, + GetKnowledgeBaseRequest, + CreateKnowledgeBaseRequest, + DeleteKnowledgeBaseRequest, + UpdateKnowledgeBaseRequest, +) +from .session_entity_type import ( + SessionEntityType, + ListSessionEntityTypesRequest, + ListSessionEntityTypesResponse, + GetSessionEntityTypeRequest, + CreateSessionEntityTypeRequest, + UpdateSessionEntityTypeRequest, + DeleteSessionEntityTypeRequest, +) +from .session import ( + DetectIntentRequest, + DetectIntentResponse, + QueryParameters, + QueryInput, + QueryResult, + KnowledgeAnswers, + StreamingDetectIntentRequest, + StreamingDetectIntentResponse, + StreamingRecognitionResult, + TextInput, + EventInput, + SentimentAnalysisRequestConfig, + SentimentAnalysisResult, + Sentiment, +) +from .webhook import ( + WebhookRequest, + WebhookResponse, + OriginalDetectIntentRequest, +) + + +__all__ = ( + "SpeechContext", + "SpeechWordInfo", + "InputAudioConfig", + "VoiceSelectionParams", + "SynthesizeSpeechConfig", + "OutputAudioConfig", + "TelephonyDtmfEvents", + "Environment", + "ListEnvironmentsRequest", + "ListEnvironmentsResponse", + "ValidationError", + "ValidationResult", + "Agent", + "GetAgentRequest", + "SetAgentRequest", + "DeleteAgentRequest", + "SubAgent", + "SearchAgentsRequest", + "SearchAgentsResponse", + "TrainAgentRequest", + "ExportAgentRequest", + "ExportAgentResponse", + "ImportAgentRequest", + "RestoreAgentRequest", + "GetValidationResultRequest", + "Context", + "ListContextsRequest", + "ListContextsResponse", + "GetContextRequest", + "CreateContextRequest", + "UpdateContextRequest", + "DeleteContextRequest", + "DeleteAllContextsRequest", + "GcsSource", + "Document", + "GetDocumentRequest", + "ListDocumentsRequest", + "ListDocumentsResponse", + "CreateDocumentRequest", + "DeleteDocumentRequest", + "UpdateDocumentRequest", + "KnowledgeOperationMetadata", + "ReloadDocumentRequest", + "EntityType", + "ListEntityTypesRequest", + "ListEntityTypesResponse", + "GetEntityTypeRequest", + "CreateEntityTypeRequest", + "UpdateEntityTypeRequest", + "DeleteEntityTypeRequest", + "BatchUpdateEntityTypesRequest", + "BatchUpdateEntityTypesResponse", + "BatchDeleteEntityTypesRequest", + "BatchCreateEntitiesRequest", + "BatchUpdateEntitiesRequest", + "BatchDeleteEntitiesRequest", + "EntityTypeBatch", + "Intent", + "ListIntentsRequest", + "ListIntentsResponse", + "GetIntentRequest", + "CreateIntentRequest", + "UpdateIntentRequest", + "DeleteIntentRequest", + "BatchUpdateIntentsRequest", + "BatchUpdateIntentsResponse", + "BatchDeleteIntentsRequest", + "IntentBatch", + "KnowledgeBase", + "ListKnowledgeBasesRequest", + "ListKnowledgeBasesResponse", + "GetKnowledgeBaseRequest", + "CreateKnowledgeBaseRequest", + "DeleteKnowledgeBaseRequest", + "UpdateKnowledgeBaseRequest", + "SessionEntityType", + "ListSessionEntityTypesRequest", + "ListSessionEntityTypesResponse", + "GetSessionEntityTypeRequest", + "CreateSessionEntityTypeRequest", + "UpdateSessionEntityTypeRequest", + "DeleteSessionEntityTypeRequest", + "DetectIntentRequest", + "DetectIntentResponse", + "QueryParameters", + "QueryInput", + "QueryResult", + "KnowledgeAnswers", + "StreamingDetectIntentRequest", + "StreamingDetectIntentResponse", + "StreamingRecognitionResult", + "TextInput", + "EventInput", + "SentimentAnalysisRequestConfig", + "SentimentAnalysisResult", + "Sentiment", + "WebhookRequest", + "WebhookResponse", + "OriginalDetectIntentRequest", +) diff --git a/google/cloud/dialogflow_v2beta1/types/agent.py b/google/cloud/dialogflow_v2beta1/types/agent.py new file mode 100644 index 000000000..5a20e4115 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/agent.py @@ -0,0 +1,400 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={ + "Agent", + "GetAgentRequest", + "SetAgentRequest", + "DeleteAgentRequest", + "SubAgent", + "SearchAgentsRequest", + "SearchAgentsResponse", + "TrainAgentRequest", + "ExportAgentRequest", + "ExportAgentResponse", + "ImportAgentRequest", + "RestoreAgentRequest", + "GetValidationResultRequest", + }, +) + + +class Agent(proto.Message): + r"""A Dialogflow agent is a virtual agent that handles conversations + with your end-users. It is a natural language understanding module + that understands the nuances of human language. Dialogflow + translates end-user text or audio during a conversation to + structured data that your apps and services can understand. You + design and build a Dialogflow agent to handle the types of + conversations required for your system. + + For more information about agents, see the `Agent + guide `__. + + Attributes: + parent (str): + Required. The project of this agent. Format: + ``projects/`` or + ``projects//locations/`` + display_name (str): + Required. The name of this agent. + default_language_code (str): + Required. The default language of the agent as a language + tag. See `Language + Support `__ + for a list of the currently supported language codes. This + field cannot be set by the ``Update`` method. + supported_language_codes (Sequence[str]): + Optional. The list of all languages supported by this agent + (except for the ``default_language_code``). + time_zone (str): + Required. The time zone of this agent from the `time zone + database `__, e.g., + America/New_York, Europe/Paris. + description (str): + Optional. The description of this agent. + The maximum length is 500 characters. If + exceeded, the request is rejected. + avatar_uri (str): + Optional. The URI of the agent's avatar. Avatars are used + throughout the Dialogflow console and in the self-hosted + `Web + Demo `__ + integration. + enable_logging (bool): + Optional. Determines whether this agent + should log conversation queries. + match_mode (~.gcd_agent.Agent.MatchMode): + Optional. Determines how intents are detected + from user queries. + classification_threshold (float): + Optional. To filter out false positive + results and still get variety in matched natural + language inputs for your agent, you can tune the + machine learning classification threshold. If + the returned score value is less than the + threshold value, then a fallback intent will be + triggered or, if there are no fallback intents + defined, no intent will be triggered. The score + values range from 0.0 (completely uncertain) to + 1.0 (completely certain). If set to 0.0, the + default of 0.3 is used. + api_version (~.gcd_agent.Agent.ApiVersion): + Optional. API version displayed in Dialogflow + console. If not specified, V2 API is assumed. + Clients are free to query different service + endpoints for different API versions. However, + bots connectors and webhook calls will follow + the specified API version. + tier (~.gcd_agent.Agent.Tier): + Optional. The agent tier. If not specified, TIER_STANDARD is + assumed. + """ + + class MatchMode(proto.Enum): + r"""Match mode determines how intents are detected from user + queries. + """ + MATCH_MODE_UNSPECIFIED = 0 + MATCH_MODE_HYBRID = 1 + MATCH_MODE_ML_ONLY = 2 + + class ApiVersion(proto.Enum): + r"""API version for the agent.""" + API_VERSION_UNSPECIFIED = 0 + API_VERSION_V1 = 1 + API_VERSION_V2 = 2 + API_VERSION_V2_BETA_1 = 3 + + class Tier(proto.Enum): + r"""Represents the agent tier.""" + TIER_UNSPECIFIED = 0 + TIER_STANDARD = 1 + TIER_ENTERPRISE = 2 + TIER_ENTERPRISE_PLUS = 3 + + parent = 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) + + enable_logging = proto.Field(proto.BOOL, number=8) + + match_mode = proto.Field(proto.ENUM, number=9, enum=MatchMode,) + + classification_threshold = proto.Field(proto.FLOAT, number=10) + + api_version = proto.Field(proto.ENUM, number=14, enum=ApiVersion,) + + tier = proto.Field(proto.ENUM, number=15, enum=Tier,) + + +class GetAgentRequest(proto.Message): + r"""The request message for + [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent]. + + Attributes: + parent (str): + Required. The project that the agent to fetch is associated + with. Format: ``projects/`` or + ``projects//locations/``. + """ + + parent = proto.Field(proto.STRING, number=1) + + +class SetAgentRequest(proto.Message): + r"""The request message for + [Agents.SetAgent][google.cloud.dialogflow.v2beta1.Agents.SetAgent]. + + Attributes: + agent (~.gcd_agent.Agent): + Required. The agent to update. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + """ + + agent = proto.Field(proto.MESSAGE, number=1, message="Agent",) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteAgentRequest(proto.Message): + r"""The request message for + [Agents.DeleteAgent][google.cloud.dialogflow.v2beta1.Agents.DeleteAgent]. + + Attributes: + parent (str): + Required. The project that the agent to delete is associated + with. Format: ``projects/`` or + ``projects//locations/``. + """ + + parent = proto.Field(proto.STRING, number=1) + + +class SubAgent(proto.Message): + r"""Contains basic configuration for a sub-agent. + + Attributes: + project (str): + Required. The project of this agent. Format: + ``projects/`` or + ``projects//locations/``. + environment (str): + Optional. The unique identifier (``environment name`` in + dialogflow console) of this sub-agent environment. Assumes + draft environment if ``environment`` is not set. + """ + + project = proto.Field(proto.STRING, number=1) + + environment = proto.Field(proto.STRING, number=2) + + +class SearchAgentsRequest(proto.Message): + r"""The request message for + [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. + + Attributes: + parent (str): + Required. The project to list agents from. Format: + ``projects/`` or + ``projects//locations/``. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list request. + """ + + parent = proto.Field(proto.STRING, number=1) + + page_size = proto.Field(proto.INT32, number=2) + + page_token = proto.Field(proto.STRING, number=3) + + +class SearchAgentsResponse(proto.Message): + r"""The response message for + [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. + + Attributes: + agents (Sequence[~.gcd_agent.Agent]): + The list of agents. There will be a maximum number of items + returned based on the page_size field in the request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + agents = proto.RepeatedField(proto.MESSAGE, number=1, message="Agent",) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class TrainAgentRequest(proto.Message): + r"""The request message for + [Agents.TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent]. + + Attributes: + parent (str): + Required. The project that the agent to train is associated + with. Format: ``projects/`` or + ``projects//locations/``. + """ + + parent = proto.Field(proto.STRING, number=1) + + +class ExportAgentRequest(proto.Message): + r"""The request message for + [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. + + Attributes: + parent (str): + Required. The project that the agent to export is associated + with. Format: ``projects/`` or + ``projects//locations/``. + agent_uri (str): + Optional. The `Google Cloud + Storage `__ URI to + export the agent to. The format of this URI must be + ``gs:///``. If left unspecified, + the serialized agent is returned inline. + """ + + parent = proto.Field(proto.STRING, number=1) + + agent_uri = proto.Field(proto.STRING, number=2) + + +class ExportAgentResponse(proto.Message): + r"""The response message for + [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. + + Attributes: + agent_uri (str): + The URI to a file containing the exported agent. This field + is populated only if ``agent_uri`` is specified in + ``ExportAgentRequest``. + agent_content (bytes): + Zip compressed raw byte content for agent. + """ + + agent_uri = proto.Field(proto.STRING, number=1, oneof="agent") + + agent_content = proto.Field(proto.BYTES, number=2, oneof="agent") + + +class ImportAgentRequest(proto.Message): + r"""The request message for + [Agents.ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent]. + + Attributes: + parent (str): + Required. The project that the agent to import is associated + with. Format: ``projects/`` or + ``projects//locations/``. + agent_uri (str): + The URI to a Google Cloud Storage file + containing the agent to import. Note: The URI + must start with "gs://". + agent_content (bytes): + Zip compressed raw byte content for agent. + """ + + parent = 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") + + +class RestoreAgentRequest(proto.Message): + r"""The request message for + [Agents.RestoreAgent][google.cloud.dialogflow.v2beta1.Agents.RestoreAgent]. + + Attributes: + parent (str): + Required. The project that the agent to restore is + associated with. Format: ``projects/`` or + ``projects//locations/``. + agent_uri (str): + The URI to a Google Cloud Storage file + containing the agent to restore. Note: The URI + must start with "gs://". + agent_content (bytes): + Zip compressed raw byte content for agent. + """ + + parent = 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") + + +class GetValidationResultRequest(proto.Message): + r"""The request message for + [Agents.GetValidationResult][google.cloud.dialogflow.v2beta1.Agents.GetValidationResult]. + + Attributes: + parent (str): + Required. The project that the agent is associated with. + Format: ``projects/`` or + ``projects//locations/``. + language_code (str): + Optional. The language for which you want a validation + result. If not specified, the agent's default language is + used. `Many + languages `__ + are supported. Note: languages must be enabled in the agent + before they can be used. + """ + + parent = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=3) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/audio_config.py b/google/cloud/dialogflow_v2beta1/types/audio_config.py new file mode 100644 index 000000000..416ae8412 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/audio_config.py @@ -0,0 +1,409 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import duration_pb2 as duration # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={ + "AudioEncoding", + "SpeechModelVariant", + "SsmlVoiceGender", + "OutputAudioEncoding", + "TelephonyDtmf", + "SpeechContext", + "SpeechWordInfo", + "InputAudioConfig", + "VoiceSelectionParams", + "SynthesizeSpeechConfig", + "OutputAudioConfig", + "TelephonyDtmfEvents", + }, +) + + +class AudioEncoding(proto.Enum): + r"""Audio encoding of the audio content sent in the conversational query + request. Refer to the `Cloud Speech API + documentation `__ + for more details. + """ + AUDIO_ENCODING_UNSPECIFIED = 0 + AUDIO_ENCODING_LINEAR_16 = 1 + AUDIO_ENCODING_FLAC = 2 + AUDIO_ENCODING_MULAW = 3 + AUDIO_ENCODING_AMR = 4 + AUDIO_ENCODING_AMR_WB = 5 + AUDIO_ENCODING_OGG_OPUS = 6 + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 + + +class SpeechModelVariant(proto.Enum): + r"""Variant of the specified [Speech + model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] to + use. + + See the `Cloud Speech + documentation `__ + for which models have different variants. For example, the + "phone_call" model has both a standard and an enhanced variant. When + you use an enhanced model, you will generally receive higher quality + results than for a standard model. + """ + SPEECH_MODEL_VARIANT_UNSPECIFIED = 0 + USE_BEST_AVAILABLE = 1 + USE_STANDARD = 2 + USE_ENHANCED = 3 + + +class SsmlVoiceGender(proto.Enum): + r"""Gender of the voice as described in `SSML voice + element `__. + """ + SSML_VOICE_GENDER_UNSPECIFIED = 0 + SSML_VOICE_GENDER_MALE = 1 + SSML_VOICE_GENDER_FEMALE = 2 + SSML_VOICE_GENDER_NEUTRAL = 3 + + +class OutputAudioEncoding(proto.Enum): + r"""Audio encoding of the output audio format in Text-To-Speech.""" + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0 + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1 + OUTPUT_AUDIO_ENCODING_MP3 = 2 + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3 + + +class TelephonyDtmf(proto.Enum): + r"""`DTMF `__ + digit in Telephony Gateway. + """ + TELEPHONY_DTMF_UNSPECIFIED = 0 + DTMF_ONE = 1 + DTMF_TWO = 2 + DTMF_THREE = 3 + DTMF_FOUR = 4 + DTMF_FIVE = 5 + DTMF_SIX = 6 + DTMF_SEVEN = 7 + DTMF_EIGHT = 8 + DTMF_NINE = 9 + DTMF_ZERO = 10 + DTMF_A = 11 + DTMF_B = 12 + DTMF_C = 13 + DTMF_D = 14 + DTMF_STAR = 15 + DTMF_POUND = 16 + + +class SpeechContext(proto.Message): + r"""Hints for the speech recognizer to help with recognition in a + specific conversation state. + + Attributes: + phrases (Sequence[str]): + Optional. A list of strings containing words and phrases + that the speech recognizer should recognize with higher + likelihood. + + This list can be used to: + + - improve accuracy for words and phrases you expect the + user to say, e.g. typical commands for your Dialogflow + agent + - add additional words to the speech recognizer vocabulary + - ... + + See the `Cloud Speech + documentation `__ + for usage limits. + boost (float): + Optional. Boost for this context compared to other contexts: + + - If the boost is positive, Dialogflow will increase the + probability that the phrases in this context are + recognized over similar sounding phrases. + - If the boost is unspecified or non-positive, Dialogflow + will not apply any boost. + + Dialogflow recommends that you use boosts in the range (0, + 20] and that you find a value that fits your use case with + binary search. + """ + + phrases = proto.RepeatedField(proto.STRING, number=1) + + boost = proto.Field(proto.FLOAT, number=2) + + +class SpeechWordInfo(proto.Message): + r"""Information for a word recognized by the speech recognizer. + + Attributes: + word (str): + The word this info is for. + start_offset (~.duration.Duration): + Time offset relative to the beginning of the + audio that corresponds to the start of the + spoken word. This is an experimental feature and + the accuracy of the time offset can vary. + end_offset (~.duration.Duration): + Time offset relative to the beginning of the + audio that corresponds to the end of the spoken + word. This is an experimental feature and the + accuracy of the time offset can vary. + confidence (float): + The Speech confidence between 0.0 and 1.0 for + this word. A higher number indicates an + estimated greater likelihood that the recognized + word is correct. The default of 0.0 is a + sentinel value indicating that confidence was + not set. + + This field is not guaranteed to be fully stable + over time for the same audio input. Users should + 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.Duration,) + + end_offset = proto.Field(proto.MESSAGE, number=2, message=duration.Duration,) + + confidence = proto.Field(proto.FLOAT, number=4) + + +class InputAudioConfig(proto.Message): + r"""Instructs the speech recognizer on how to process the audio + content. + + Attributes: + audio_encoding (~.audio_config.AudioEncoding): + Required. Audio encoding of the audio content + to process. + sample_rate_hertz (int): + Required. Sample rate (in Hertz) of the audio content sent + in the query. Refer to `Cloud Speech API + documentation `__ + for more details. + language_code (str): + Required. The language of the supplied audio. Dialogflow + does not do translations. See `Language + Support `__ + for a list of the currently supported language codes. Note + that queries in the same session do not necessarily need to + specify the same language. + enable_word_info (bool): + If ``true``, Dialogflow returns + [SpeechWordInfo][google.cloud.dialogflow.v2beta1.SpeechWordInfo] + in + [StreamingRecognitionResult][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult] + with information about the recognized speech words, e.g. + start and end time offsets. If false or unspecified, Speech + doesn't return any word-level information. + phrase_hints (Sequence[str]): + A list of strings containing words and phrases that the + speech recognizer should recognize with higher likelihood. + + See `the Cloud Speech + documentation `__ + for more details. + + This field is deprecated. Please use `speech_contexts <>`__ + instead. If you specify both `phrase_hints <>`__ and + `speech_contexts <>`__, Dialogflow will treat the + `phrase_hints <>`__ as a single additional + `SpeechContext <>`__. + speech_contexts (Sequence[~.audio_config.SpeechContext]): + Context information to assist speech recognition. + + See `the Cloud Speech + documentation `__ + for more details. + model (str): + Which Speech model to select for the given request. Select + the model best suited to your domain to get best results. If + a model is not explicitly specified, then we auto-select a + model based on the parameters in the InputAudioConfig. If + enhanced speech model is enabled for the agent and an + enhanced version of the specified model for the language + does not exist, then the speech is recognized using the + standard version of the specified model. Refer to `Cloud + Speech API + documentation `__ + for more details. + model_variant (~.audio_config.SpeechModelVariant): + Which variant of the [Speech + model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] + to use. + single_utterance (bool): + If ``false`` (default), recognition does not cease until the + client closes the stream. If ``true``, the recognizer will + detect a single spoken utterance in input audio. Recognition + ceases when it detects the audio's voice has stopped or + paused. In this case, once a detected intent is received, + the client should close the stream and start a new request + with a new stream as needed. Note: This setting is relevant + only for streaming methods. Note: When specified, + InputAudioConfig.single_utterance takes precedence over + StreamingDetectIntentRequest.single_utterance. + """ + + audio_encoding = proto.Field(proto.ENUM, number=1, enum="AudioEncoding",) + + sample_rate_hertz = proto.Field(proto.INT32, number=2) + + language_code = proto.Field(proto.STRING, number=3) + + enable_word_info = proto.Field(proto.BOOL, number=13) + + phrase_hints = proto.RepeatedField(proto.STRING, number=4) + + speech_contexts = proto.RepeatedField( + proto.MESSAGE, number=11, message="SpeechContext", + ) + + 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): + r"""Description of which voice to use for speech synthesis. + + Attributes: + name (str): + Optional. The name of the voice. If not set, the service + will choose a voice based on the other parameters such as + language_code and + [ssml_gender][google.cloud.dialogflow.v2beta1.VoiceSelectionParams.ssml_gender]. + ssml_gender (~.audio_config.SsmlVoiceGender): + Optional. The preferred gender of the voice. If not set, the + service will choose a voice based on the other parameters + such as language_code and + [name][google.cloud.dialogflow.v2beta1.VoiceSelectionParams.name]. + Note that this is only a preference, not requirement. If a + voice of the appropriate gender is not available, the + synthesizer should substitute a voice with a different + gender rather than failing the request. + """ + + name = proto.Field(proto.STRING, number=1) + + ssml_gender = proto.Field(proto.ENUM, number=2, enum="SsmlVoiceGender",) + + +class SynthesizeSpeechConfig(proto.Message): + r"""Configuration of how speech should be synthesized. + + Attributes: + speaking_rate (float): + Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 + is the normal native speed supported by the specific voice. + 2.0 is twice as fast, and 0.5 is half as fast. If + unset(0.0), defaults to the native 1.0 speed. Any other + values < 0.25 or > 4.0 will return an error. + pitch (float): + Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 + means increase 20 semitones from the original pitch. -20 + means decrease 20 semitones from the original pitch. + volume_gain_db (float): + Optional. Volume gain (in dB) of the normal native volume + supported by the specific voice, in the range [-96.0, 16.0]. + If unset, or set to a value of 0.0 (dB), will play at normal + native signal amplitude. A value of -6.0 (dB) will play at + approximately half the amplitude of the normal native signal + amplitude. A value of +6.0 (dB) will play at approximately + twice the amplitude of the normal native signal amplitude. + We strongly recommend not to exceed +10 (dB) as there's + usually no effective increase in loudness for any value + greater than that. + effects_profile_id (Sequence[str]): + Optional. An identifier which selects 'audio + effects' profiles that are applied on (post + synthesized) text to speech. Effects are applied + on top of each other in the order they are + given. + voice (~.audio_config.VoiceSelectionParams): + Optional. The desired voice of the + 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",) + + +class OutputAudioConfig(proto.Message): + r"""Instructs the speech synthesizer how to generate the output + audio content. If this audio config is supplied in a request, it + overrides all existing text-to-speech settings applied to the + agent. + + Attributes: + audio_encoding (~.audio_config.OutputAudioEncoding): + Required. Audio encoding of the synthesized + audio content. + sample_rate_hertz (int): + The synthesis sample rate (in hertz) for this + audio. If not provided, then the synthesizer + will use the default sample rate based on the + audio encoding. If this is different from the + voice's natural sample rate, then the + synthesizer will honor this request by + converting to the desired sample rate (which + might result in worse audio quality). + synthesize_speech_config (~.audio_config.SynthesizeSpeechConfig): + Configuration of how speech should be + synthesized. + """ + + 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", + ) + + +class TelephonyDtmfEvents(proto.Message): + r"""A wrapper of repeated TelephonyDtmf digits. + + Attributes: + dtmf_events (Sequence[~.audio_config.TelephonyDtmf]): + A sequence of TelephonyDtmf digits. + """ + + dtmf_events = proto.RepeatedField(proto.ENUM, number=1, enum="TelephonyDtmf",) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/context.py b/google/cloud/dialogflow_v2beta1/types/context.py new file mode 100644 index 000000000..cf3f152ee --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/context.py @@ -0,0 +1,286 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={ + "Context", + "ListContextsRequest", + "ListContextsResponse", + "GetContextRequest", + "CreateContextRequest", + "UpdateContextRequest", + "DeleteContextRequest", + "DeleteAllContextsRequest", + }, +) + + +class Context(proto.Message): + r"""Dialogflow contexts are similar to natural language context. If a + person says to you "they are orange", you need context in order to + understand what "they" is referring to. Similarly, for Dialogflow to + handle an end-user expression like that, it needs to be provided + with context in order to correctly match an intent. + + Using contexts, you can control the flow of a conversation. You can + configure contexts for an intent by setting input and output + contexts, which are identified by string names. When an intent is + matched, any configured output contexts for that intent become + active. While any contexts are active, Dialogflow is more likely to + match intents that are configured with input contexts that + correspond to the currently active contexts. + + For more information about context, see the `Contexts + guide `__. + + Attributes: + name (str): + Required. The unique identifier of the context. Supported + formats: + + - ``projects//agent/sessions//contexts/``, + - ``projects//locations//agent/sessions//contexts/``, + - ``projects//agent/environments//users//sessions//contexts/``, + - ``projects//locations//agent/environments//users//sessions//contexts/``, + + The ``Context ID`` is always converted to lowercase, may + only contain characters in a-zA-Z0-9_-% and may be at most + 250 bytes long. + + If ``Environment ID`` is not specified, we assume default + 'draft' environment. If ``User ID`` is not specified, we + assume default '-' user. + + The following context names are reserved for internal use by + Dialogflow. You should not use these contexts or create + contexts with these names: + + - ``__system_counters__`` + - ``*_id_dialog_context`` + - ``*_dialog_params_size`` + lifespan_count (int): + Optional. The number of conversational query requests after + which the context expires. The default is ``0``. If set to + ``0``, the context expires immediately. Contexts expire + automatically after 20 minutes if there are no matching + queries. + parameters (~.struct.Struct): + Optional. The collection of parameters + associated with this context. + 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: string or + number, depending on parameter value type - + MapValue value: + - If parameter's entity type is a + composite entity: map from composite + entity property names to property values - + Else: parameter value + """ + + name = proto.Field(proto.STRING, number=1) + + lifespan_count = proto.Field(proto.INT32, number=2) + + parameters = proto.Field(proto.MESSAGE, number=3, message=struct.Struct,) + + +class ListContextsRequest(proto.Message): + r"""The request message for + [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. + + Attributes: + parent (str): + Required. The session to list all contexts from. Supported + formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list request. + """ + + parent = proto.Field(proto.STRING, number=1) + + page_size = proto.Field(proto.INT32, number=2) + + page_token = proto.Field(proto.STRING, number=3) + + +class ListContextsResponse(proto.Message): + r"""The response message for + [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. + + Attributes: + contexts (Sequence[~.gcd_context.Context]): + The list of contexts. There will be a maximum number of + items returned based on the page_size field in the request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + contexts = proto.RepeatedField(proto.MESSAGE, number=1, message="Context",) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class GetContextRequest(proto.Message): + r"""The request message for + [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext]. + + Attributes: + name (str): + Required. The name of the context. Supported formats: + + - ``projects//agent/sessions//contexts/``, + - ``projects//locations//agent/sessions//contexts/``, + - ``projects//agent/environments//users//sessions//contexts/``, + - ``projects//locations//agent/environments//users//sessions//contexts/``, + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + """ + + name = proto.Field(proto.STRING, number=1) + + +class CreateContextRequest(proto.Message): + r"""The request message for + [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext]. + + Attributes: + parent (str): + Required. The session to create a context for. Supported + formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + context (~.gcd_context.Context): + Required. The context to create. + """ + + parent = proto.Field(proto.STRING, number=1) + + context = proto.Field(proto.MESSAGE, number=2, message="Context",) + + +class UpdateContextRequest(proto.Message): + r"""The request message for + [Contexts.UpdateContext][google.cloud.dialogflow.v2beta1.Contexts.UpdateContext]. + + Attributes: + context (~.gcd_context.Context): + Required. The context to update. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + """ + + context = proto.Field(proto.MESSAGE, number=1, message="Context",) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteContextRequest(proto.Message): + r"""The request message for + [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext]. + + Attributes: + name (str): + Required. The name of the context to delete. Supported + formats: + + - ``projects//agent/sessions//contexts/``, + - ``projects//locations//agent/sessions//contexts/``, + - ``projects//agent/environments//users//sessions//contexts/``, + - ``projects//locations//agent/environments//users//sessions//contexts/``, + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + """ + + name = proto.Field(proto.STRING, number=1) + + +class DeleteAllContextsRequest(proto.Message): + r"""The request message for + [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts]. + + Attributes: + parent (str): + Required. The name of the session to delete all contexts + from. Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + """ + + parent = proto.Field(proto.STRING, number=1) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/document.py b/google/cloud/dialogflow_v2beta1/types/document.py new file mode 100644 index 000000000..6cba8305b --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/document.py @@ -0,0 +1,342 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.cloud.dialogflow_v2beta1.types import gcs +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.rpc import status_pb2 as gr_status # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={ + "Document", + "GetDocumentRequest", + "ListDocumentsRequest", + "ListDocumentsResponse", + "CreateDocumentRequest", + "DeleteDocumentRequest", + "UpdateDocumentRequest", + "KnowledgeOperationMetadata", + "ReloadDocumentRequest", + }, +) + + +class Document(proto.Message): + r"""A knowledge document to be used by a + [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases.documents`` resource is + deprecated; only use ``projects.knowledgeBases.documents``. + + Attributes: + name (str): + Optional. The document resource name. The name must be empty + when creating a document. Format: + ``projects//locations//knowledgeBases//documents/``. + display_name (str): + Required. The display name of the document. + The name must be 1024 bytes or less; otherwise, + the creation request fails. + mime_type (str): + Required. The MIME type of this document. + knowledge_types (Sequence[~.gcd_document.Document.KnowledgeType]): + Required. The knowledge type of document + content. + content_uri (str): + The URI where the file content is located. + + For documents stored in Google Cloud Storage, these URIs + must have the form ``gs:///``. + + NOTE: External URLs must correspond to public webpages, + i.e., they must be indexed by Google Search. In particular, + URLs for showing documents in Google Cloud Storage (i.e. the + URL in your browser) are not supported. Instead use the + ``gs://`` format URI described above. + content (str): + The raw content of the document. This field is only + permitted for EXTRACTIVE_QA and FAQ knowledge types. Note: + This field is in the process of being deprecated, please use + raw_content instead. + raw_content (bytes): + The raw content of the document. This field is only + permitted for EXTRACTIVE_QA and FAQ knowledge types. + enable_auto_reload (bool): + Optional. If true, we try to automatically reload the + document every day (at a time picked by the system). If + false or unspecified, we don't try to automatically reload + the document. + + Currently you can only enable automatic reload for documents + sourced from a public url, see ``source`` field for the + source types. + + Reload status can be tracked in ``latest_reload_status``. If + a reload fails, we will keep the document unchanged. + + If a reload fails with internal errors, the system will try + to reload the document on the next day. If a reload fails + with non-retriable errors (e.g. PERMISION_DENIED), the + system will not try to reload the document anymore. You need + to manually reload the document successfully by calling + ``ReloadDocument`` and clear the errors. + latest_reload_status (~.gcd_document.Document.ReloadStatus): + Output only. The time and status of the + latest reload. This reload may have been + triggered automatically or manually and may not + have succeeded. + """ + + class KnowledgeType(proto.Enum): + r"""The knowledge type of document content.""" + KNOWLEDGE_TYPE_UNSPECIFIED = 0 + FAQ = 1 + EXTRACTIVE_QA = 2 + + class ReloadStatus(proto.Message): + r"""The status of a reload attempt. + + Attributes: + time (~.timestamp.Timestamp): + Output only. The time of a reload attempt. + This reload may have been triggered + automatically or manually and may not have + succeeded. + status (~.gr_status.Status): + Output only. The status of a reload attempt + or the initial load. + """ + + time = proto.Field(proto.MESSAGE, number=1, message=timestamp.Timestamp,) + + status = proto.Field(proto.MESSAGE, number=2, message=gr_status.Status,) + + name = proto.Field(proto.STRING, number=1) + + display_name = proto.Field(proto.STRING, number=2) + + mime_type = proto.Field(proto.STRING, number=3) + + knowledge_types = proto.RepeatedField(proto.ENUM, number=4, enum=KnowledgeType,) + + content_uri = proto.Field(proto.STRING, number=5, oneof="source") + + content = proto.Field(proto.STRING, number=6, oneof="source") + + raw_content = proto.Field(proto.BYTES, number=9, oneof="source") + + enable_auto_reload = proto.Field(proto.BOOL, number=11) + + latest_reload_status = proto.Field(proto.MESSAGE, number=12, message=ReloadStatus,) + + +class GetDocumentRequest(proto.Message): + r"""Request message for + [Documents.GetDocument][google.cloud.dialogflow.v2beta1.Documents.GetDocument]. + + Attributes: + name (str): + Required. The name of the document to retrieve. Format + ``projects//locations//knowledgeBases//documents/``. + """ + + name = proto.Field(proto.STRING, number=1) + + +class ListDocumentsRequest(proto.Message): + r"""Request message for + [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. + + Attributes: + parent (str): + Required. The knowledge base to list all documents for. + Format: + ``projects//locations//knowledgeBases/``. + page_size (int): + The maximum number of items to return in a + single page. By default 10 and at most 100. + page_token (str): + The next_page_token value returned from a previous list + request. + filter (str): + The filter expression used to filter documents returned by + the list method. The expression has the following syntax: + + [AND ] ... + + The following fields and operators are supported: + + - knowledge_types with has(:) operator + - display_name with has(:) operator + - state with equals(=) operator + + Examples: + + - "knowledge_types:FAQ" matches documents with FAQ + knowledge type. + - "display_name:customer" matches documents whose display + name contains "customer". + - "state=ACTIVE" matches documents with ACTIVE state. + - "knowledge_types:FAQ AND state=ACTIVE" matches all active + FAQ documents. + + For more information about filtering, see `API + Filtering `__. + """ + + 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 ListDocumentsResponse(proto.Message): + r"""Response message for + [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. + + Attributes: + documents (Sequence[~.gcd_document.Document]): + The list of documents. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + documents = proto.RepeatedField(proto.MESSAGE, number=1, message="Document",) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class CreateDocumentRequest(proto.Message): + r"""Request message for + [Documents.CreateDocument][google.cloud.dialogflow.v2beta1.Documents.CreateDocument]. + + Attributes: + parent (str): + Required. The knowledge base to create a document for. + Format: + ``projects//locations//knowledgeBases/``. + document (~.gcd_document.Document): + Required. The document to create. + import_gcs_custom_metadata (bool): + Whether to import custom metadata from Google + Cloud Storage. Only valid when the document + source is Google Cloud Storage URI. + """ + + parent = proto.Field(proto.STRING, number=1) + + document = proto.Field(proto.MESSAGE, number=2, message="Document",) + + import_gcs_custom_metadata = proto.Field(proto.BOOL, number=3) + + +class DeleteDocumentRequest(proto.Message): + r"""Request message for + [Documents.DeleteDocument][google.cloud.dialogflow.v2beta1.Documents.DeleteDocument]. + + Attributes: + name (str): + Required. The name of the document to delete. Format: + ``projects//locations//knowledgeBases//documents/``. + """ + + name = proto.Field(proto.STRING, number=1) + + +class UpdateDocumentRequest(proto.Message): + r"""Request message for + [Documents.UpdateDocument][google.cloud.dialogflow.v2beta1.Documents.UpdateDocument]. + + Attributes: + document (~.gcd_document.Document): + Required. The document to update. + update_mask (~.field_mask.FieldMask): + Optional. Not specified means ``update all``. Currently, + only ``display_name`` can be updated, an InvalidArgument + will be returned for attempting to update other fields. + """ + + document = proto.Field(proto.MESSAGE, number=1, message="Document",) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class KnowledgeOperationMetadata(proto.Message): + r"""Metadata in google::longrunning::Operation for Knowledge + operations. + + Attributes: + state (~.gcd_document.KnowledgeOperationMetadata.State): + Required. Output only. The current state of + this operation. + """ + + class State(proto.Enum): + r"""States of the operation.""" + STATE_UNSPECIFIED = 0 + PENDING = 1 + RUNNING = 2 + DONE = 3 + + state = proto.Field(proto.ENUM, number=1, enum=State,) + + +class ReloadDocumentRequest(proto.Message): + r"""Request message for + [Documents.ReloadDocument][google.cloud.dialogflow.v2beta1.Documents.ReloadDocument]. + + Attributes: + name (str): + Required. The name of the document to reload. Format: + ``projects//locations//knowledgeBases//documents/`` + gcs_source (~.gcs.GcsSource): + The path for a Cloud Storage source file for + reloading document content. If not provided, the + Document's existing source will be reloaded. + import_gcs_custom_metadata (bool): + Whether to import custom metadata from Google + Cloud Storage. Only valid when the document + source is Google Cloud Storage URI. + """ + + name = proto.Field(proto.STRING, number=1) + + gcs_source = proto.Field( + proto.MESSAGE, number=3, oneof="source", message=gcs.GcsSource, + ) + + import_gcs_custom_metadata = proto.Field(proto.BOOL, number=4) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/entity_type.py b/google/cloud/dialogflow_v2beta1/types/entity_type.py new file mode 100644 index 000000000..b26f8ecfd --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/entity_type.py @@ -0,0 +1,484 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={ + "EntityType", + "ListEntityTypesRequest", + "ListEntityTypesResponse", + "GetEntityTypeRequest", + "CreateEntityTypeRequest", + "UpdateEntityTypeRequest", + "DeleteEntityTypeRequest", + "BatchUpdateEntityTypesRequest", + "BatchUpdateEntityTypesResponse", + "BatchDeleteEntityTypesRequest", + "BatchCreateEntitiesRequest", + "BatchUpdateEntitiesRequest", + "BatchDeleteEntitiesRequest", + "EntityTypeBatch", + }, +) + + +class EntityType(proto.Message): + r"""Each intent parameter has a type, called the entity type, which + dictates exactly how data from an end-user expression is extracted. + + Dialogflow provides predefined system entities that can match many + common types of data. For example, there are system entities for + matching dates, times, colors, email addresses, and so on. You can + also create your own custom entities for matching custom data. For + example, you could define a vegetable entity that can match the + types of vegetables available for purchase with a grocery store + agent. + + For more information, see the `Entity + guide `__. + + Attributes: + name (str): + The unique identifier of the entity type. Required for + [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType] + and + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes] + methods. Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + display_name (str): + Required. The name of the entity type. + kind (~.gcd_entity_type.EntityType.Kind): + Required. Indicates the kind of entity type. + auto_expansion_mode (~.gcd_entity_type.EntityType.AutoExpansionMode): + Optional. Indicates whether the entity type + can be automatically expanded. + entities (Sequence[~.gcd_entity_type.EntityType.Entity]): + Optional. The collection of entity entries + associated with the entity type. + enable_fuzzy_extraction (bool): + Optional. Enables fuzzy entity extraction + during classification. + """ + + class Kind(proto.Enum): + r"""Represents kinds of entities.""" + KIND_UNSPECIFIED = 0 + KIND_MAP = 1 + KIND_LIST = 2 + KIND_REGEXP = 3 + + class AutoExpansionMode(proto.Enum): + r"""Represents different entity type expansion modes. Automated + expansion allows an agent to recognize values that have not been + explicitly listed in the entity (for example, new kinds of + shopping list items). + """ + AUTO_EXPANSION_MODE_UNSPECIFIED = 0 + AUTO_EXPANSION_MODE_DEFAULT = 1 + + class Entity(proto.Message): + r"""An **entity entry** for an associated entity type. + + Attributes: + value (str): + Required. The primary value associated with this entity + entry. For example, if the entity type is *vegetable*, the + value could be *scallions*. + + For ``KIND_MAP`` entity types: + + - A reference value to be used in place of synonyms. + + For ``KIND_LIST`` entity types: + + - A string that can contain references to other entity + types (with or without aliases). + synonyms (Sequence[str]): + Required. A collection of value synonyms. For example, if + the entity type is *vegetable*, and ``value`` is + *scallions*, a synonym could be *green onions*. + + For ``KIND_LIST`` entity types: + + - This collection must contain exactly one synonym equal to + ``value``. + """ + + value = proto.Field(proto.STRING, number=1) + + synonyms = proto.RepeatedField(proto.STRING, number=2) + + 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=6, message=Entity,) + + enable_fuzzy_extraction = proto.Field(proto.BOOL, number=7) + + +class ListEntityTypesRequest(proto.Message): + r"""The request message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. + + Attributes: + parent (str): + Required. The agent to list all entity types from. Supported + formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list 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) + + +class ListEntityTypesResponse(proto.Message): + r"""The response message for + [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. + + Attributes: + entity_types (Sequence[~.gcd_entity_type.EntityType]): + The list of agent entity types. There will be a maximum + number of items returned based on the page_size field in the + request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + 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) + + +class GetEntityTypeRequest(proto.Message): + r"""The request message for + [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType]. + + Attributes: + name (str): + Required. The name of the entity type. Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + """ + + name = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=2) + + +class CreateEntityTypeRequest(proto.Message): + r"""The request message for + [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType]. + + Attributes: + parent (str): + Required. The agent to create a entity type for. Supported + formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + entity_type (~.gcd_entity_type.EntityType): + Required. The entity type to create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + """ + + 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): + r"""The request message for + [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType]. + + Attributes: + entity_type (~.gcd_entity_type.EntityType): + Required. The entity type to update. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + update_mask (~.field_mask.FieldMask): + Optional. 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) + + update_mask = proto.Field(proto.MESSAGE, number=3, message=field_mask.FieldMask,) + + +class DeleteEntityTypeRequest(proto.Message): + r"""The request message for + [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType]. + + Attributes: + name (str): + Required. The name of the entity type to delete. Supported + formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + """ + + name = proto.Field(proto.STRING, number=1) + + +class BatchUpdateEntityTypesRequest(proto.Message): + r"""The request message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. + + Attributes: + parent (str): + Required. The name of the agent to update or create entity + types in. Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + entity_type_batch_uri (str): + The URI to a Google Cloud Storage file + containing entity types to update or create. The + file format can either be a serialized proto (of + EntityBatch type) or a JSON object. Note: The + URI must start with "gs://". + entity_type_batch_inline (~.gcd_entity_type.EntityTypeBatch): + The collection of entity types to update or + create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + """ + + parent = proto.Field(proto.STRING, number=1) + + entity_type_batch_uri = proto.Field( + proto.STRING, number=2, oneof="entity_type_batch" + ) + + entity_type_batch_inline = proto.Field( + proto.MESSAGE, number=3, oneof="entity_type_batch", message="EntityTypeBatch", + ) + + language_code = proto.Field(proto.STRING, number=4) + + update_mask = proto.Field(proto.MESSAGE, number=5, message=field_mask.FieldMask,) + + +class BatchUpdateEntityTypesResponse(proto.Message): + r"""The response message for + [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. + + Attributes: + entity_types (Sequence[~.gcd_entity_type.EntityType]): + The collection of updated or created entity + types. + """ + + entity_types = proto.RepeatedField(proto.MESSAGE, number=1, message="EntityType",) + + +class BatchDeleteEntityTypesRequest(proto.Message): + r"""The request message for + [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes]. + + Attributes: + parent (str): + Required. The name of the agent to delete all entities types + for. Supported formats: + + - ``projects//agent``, + - ``projects//locations//agent``. + entity_type_names (Sequence[str]): + Required. The names entity types to delete. All names must + point to the same agent as ``parent``. + """ + + parent = proto.Field(proto.STRING, number=1) + + entity_type_names = proto.RepeatedField(proto.STRING, number=2) + + +class BatchCreateEntitiesRequest(proto.Message): + r"""The request message for + [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. + + Attributes: + parent (str): + Required. The name of the entity type to create entities in. + Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + entities (Sequence[~.gcd_entity_type.EntityType.Entity]): + Required. The entities to create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + """ + + parent = proto.Field(proto.STRING, number=1) + + entities = proto.RepeatedField( + proto.MESSAGE, number=2, message="EntityType.Entity", + ) + + language_code = proto.Field(proto.STRING, number=3) + + +class BatchUpdateEntitiesRequest(proto.Message): + r"""The request message for + [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities]. + + Attributes: + parent (str): + Required. The name of the entity type to update or create + entities in. Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + entities (Sequence[~.gcd_entity_type.EntityType.Entity]): + Required. The entities to update or create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + """ + + parent = proto.Field(proto.STRING, number=1) + + entities = proto.RepeatedField( + proto.MESSAGE, number=2, message="EntityType.Entity", + ) + + language_code = proto.Field(proto.STRING, number=3) + + update_mask = proto.Field(proto.MESSAGE, number=4, message=field_mask.FieldMask,) + + +class BatchDeleteEntitiesRequest(proto.Message): + r"""The request message for + [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities]. + + Attributes: + parent (str): + Required. The name of the entity type to delete entries for. + Supported formats: + + - ``projects//agent/entityTypes/`` + - ``projects//locations//agent/entityTypes/`` + entity_values (Sequence[str]): + Required. The reference ``values`` of the entities to + delete. Note that these are not fully-qualified names, i.e. + they don't start with ``projects/``. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + """ + + parent = proto.Field(proto.STRING, number=1) + + entity_values = proto.RepeatedField(proto.STRING, number=2) + + language_code = proto.Field(proto.STRING, number=3) + + +class EntityTypeBatch(proto.Message): + r"""This message is a wrapper around a collection of entity + types. + + Attributes: + entity_types (Sequence[~.gcd_entity_type.EntityType]): + A collection of entity types. + """ + + entity_types = proto.RepeatedField(proto.MESSAGE, number=1, message="EntityType",) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/environment.py b/google/cloud/dialogflow_v2beta1/types/environment.py new file mode 100644 index 000000000..137f9e3bf --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/environment.py @@ -0,0 +1,153 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={"Environment", "ListEnvironmentsRequest", "ListEnvironmentsResponse",}, +) + + +class Environment(proto.Message): + r"""You can create multiple versions of your agent and publish them to + separate environments. + + When you edit an agent, you are editing the draft agent. At any + point, you can save the draft agent as an agent version, which is an + immutable snapshot of your agent. + + When you save the draft agent, it is published to the default + environment. When you create agent versions, you can publish them to + custom environments. You can create a variety of custom environments + for: + + - testing + - development + - production + - etc. + + For more information, see the `versions and environments + guide `__. + + Attributes: + name (str): + Output only. The unique identifier of this agent + environment. Supported formats: + + - ``projects//agent/environments/`` + - ``projects//locations//agent/environments/`` + description (str): + Optional. The developer-provided description + for this environment. The maximum length is 500 + characters. If exceeded, the request is + rejected. + agent_version (str): + Optional. The agent version loaded into this environment. + Supported formats: + + - ``projects//agent/versions/`` + - ``projects//locations//agent/versions/`` + state (~.environment.Environment.State): + Output only. The state of this environment. + This field is read-only, i.e., it cannot be set + by create and update methods. + update_time (~.timestamp.Timestamp): + Output only. The last update time of this + environment. This field is read-only, i.e., it + cannot be set by create and update methods. + """ + + class State(proto.Enum): + r"""Represents an environment state. When an environment is pointed to a + new agent version, the environment is temporarily set to the + ``LOADING`` state. During that time, the environment keeps on + serving the previous version of the agent. After the new agent + version is done loading, the environment is set back to the + ``RUNNING`` state. + """ + STATE_UNSPECIFIED = 0 + STOPPED = 1 + LOADING = 2 + RUNNING = 3 + + name = proto.Field(proto.STRING, number=1) + + description = proto.Field(proto.STRING, number=2) + + agent_version = proto.Field(proto.STRING, number=3) + + state = proto.Field(proto.ENUM, number=4, enum=State,) + + update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp.Timestamp,) + + +class ListEnvironmentsRequest(proto.Message): + r"""The request message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. + + Attributes: + parent (str): + Required. The agent to list all environments from. Format: + + - ``projects//agent`` + - ``projects//locations//agent`` + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list request. + """ + + 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): + r"""The response message for + [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. + + Attributes: + environments (Sequence[~.environment.Environment]): + The list of agent environments. There will be a maximum + number of items returned based on the page_size field in the + request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + environments = proto.RepeatedField(proto.MESSAGE, number=1, message="Environment",) + + next_page_token = proto.Field(proto.STRING, number=2) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/gcs.py b/google/cloud/dialogflow_v2beta1/types/gcs.py new file mode 100644 index 000000000..258f2dde9 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/gcs.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", manifest={"GcsSource",}, +) + + +class GcsSource(proto.Message): + r"""Google Cloud Storage location for single input. + + Attributes: + uri (str): + Required. The Google Cloud Storage URIs for + the inputs. A URI is of the form: + gs://bucket/object-prefix-or-name + Whether a prefix or name is used depends on the + use case. + """ + + uri = proto.Field(proto.STRING, number=1) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/intent.py b/google/cloud/dialogflow_v2beta1/types/intent.py new file mode 100644 index 000000000..bf83633c4 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/intent.py @@ -0,0 +1,1839 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.cloud.dialogflow_v2beta1.types import context +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={ + "IntentView", + "Intent", + "ListIntentsRequest", + "ListIntentsResponse", + "GetIntentRequest", + "CreateIntentRequest", + "UpdateIntentRequest", + "DeleteIntentRequest", + "BatchUpdateIntentsRequest", + "BatchUpdateIntentsResponse", + "BatchDeleteIntentsRequest", + "IntentBatch", + }, +) + + +class IntentView(proto.Enum): + r"""Represents the options for views of an intent. + An intent can be a sizable object. Therefore, we provide a + resource view that does not return training phrases in the + response by default. + """ + INTENT_VIEW_UNSPECIFIED = 0 + INTENT_VIEW_FULL = 1 + + +class Intent(proto.Message): + r"""An intent categorizes an end-user's intention for one conversation + turn. For each agent, you define many intents, where your combined + intents can handle a complete conversation. When an end-user writes + or says something, referred to as an end-user expression or end-user + input, Dialogflow matches the end-user input to the best intent in + your agent. Matching an intent is also known as intent + classification. + + For more information, see the `intent + guide `__. + + Attributes: + name (str): + Optional. The unique identifier of this intent. Required for + [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent] + and + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents] + methods. Supported formats: + + - ``projects//agent/intents/`` + - ``projects//locations//agent/intents/`` + display_name (str): + Required. The name of this intent. + webhook_state (~.gcd_intent.Intent.WebhookState): + Optional. Indicates whether webhooks are + enabled for the intent. + priority (int): + Optional. The priority of this intent. Higher numbers + represent higher priorities. + + - If the supplied value is unspecified or 0, the service + translates the value to 500,000, which corresponds to the + ``Normal`` priority in the console. + - If the supplied value is negative, the intent is ignored + in runtime detect intent requests. + is_fallback (bool): + Optional. Indicates whether this is a + fallback intent. + ml_enabled (bool): + Optional. Indicates whether Machine Learning is enabled for + the intent. Note: If ``ml_enabled`` setting is set to false, + then this intent is not taken into account during inference + in ``ML ONLY`` match mode. Also, auto-markup in the UI is + turned off. DEPRECATED! Please use ``ml_disabled`` field + instead. NOTE: If both ``ml_enabled`` and ``ml_disabled`` + are either not set or false, then the default value is + determined as follows: + + - Before April 15th, 2018 the default is: ml_enabled = + false / ml_disabled = true. + - After April 15th, 2018 the default is: ml_enabled = true + / ml_disabled = false. + ml_disabled (bool): + Optional. Indicates whether Machine Learning is disabled for + the intent. Note: If ``ml_disabled`` setting is set to true, + then this intent is not taken into account during inference + in ``ML ONLY`` match mode. Also, auto-markup in the UI is + turned off. + end_interaction (bool): + Optional. Indicates that this intent ends an + interaction. Some integrations (e.g., Actions on + Google or Dialogflow phone gateway) use this + information to close interaction with an end + user. Default is false. + input_context_names (Sequence[str]): + Optional. The list of context names required for this intent + to be triggered. Formats: + + - ``projects//agent/sessions/-/contexts/`` + - ``projects//locations//agent/sessions/-/contexts/`` + events (Sequence[str]): + Optional. The collection of event names that + trigger the intent. If the collection of input + contexts is not empty, all of the contexts must + be present in the active user session for an + event to trigger this intent. Event names are + limited to 150 characters. + training_phrases (Sequence[~.gcd_intent.Intent.TrainingPhrase]): + Optional. The collection of examples that the + agent is trained on. + action (str): + Optional. The name of the action associated + with the intent. Note: The action name must not + contain whitespaces. + output_contexts (Sequence[~.context.Context]): + Optional. The collection of contexts that are activated when + the intent is matched. Context messages in this collection + should not set the parameters field. Setting the + ``lifespan_count`` to 0 will reset the context when the + intent is matched. Format: + ``projects//agent/sessions/-/contexts/``. + reset_contexts (bool): + Optional. Indicates whether to delete all + contexts in the current session when this intent + is matched. + parameters (Sequence[~.gcd_intent.Intent.Parameter]): + Optional. The collection of parameters + associated with the intent. + messages (Sequence[~.gcd_intent.Intent.Message]): + Optional. The collection of rich messages corresponding to + the ``Response`` field in the Dialogflow console. + default_response_platforms (Sequence[~.gcd_intent.Intent.Message.Platform]): + Optional. The list of platforms for which the first + responses will be copied from the messages in + PLATFORM_UNSPECIFIED (i.e. default platform). + root_followup_intent_name (str): + Output only. The unique identifier of the root intent in the + chain of followup intents. It identifies the correct + followup intents chain for this intent. + + Format: ``projects//agent/intents/``. + parent_followup_intent_name (str): + Optional. The unique identifier of the parent intent in the + chain of followup intents. You can set this field when + creating an intent, for example with + [CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent] + or + [BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents], + in order to make this intent a followup intent. + + It identifies the parent followup intent. Format: + ``projects//agent/intents/``. + followup_intent_info (Sequence[~.gcd_intent.Intent.FollowupIntentInfo]): + Output only. Information about all followup + intents that have this intent as a direct or + indirect parent. We populate this field only in + the output. + """ + + class WebhookState(proto.Enum): + r"""Represents the different states that webhooks can be in.""" + WEBHOOK_STATE_UNSPECIFIED = 0 + WEBHOOK_STATE_ENABLED = 1 + WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2 + + class TrainingPhrase(proto.Message): + r"""Represents an example that the agent is trained on. + + Attributes: + name (str): + Output only. The unique identifier of this + training phrase. + type_ (~.gcd_intent.Intent.TrainingPhrase.Type): + Required. The type of the training phrase. + parts (Sequence[~.gcd_intent.Intent.TrainingPhrase.Part]): + Required. The ordered list of training phrase parts. The + parts are concatenated in order to form the training phrase. + + Note: The API does not automatically annotate training + phrases like the Dialogflow Console does. + + Note: Do not forget to include whitespace at part + boundaries, so the training phrase is well formatted when + the parts are concatenated. + + If the training phrase does not need to be annotated with + parameters, you just need a single part with only the + [Part.text][google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.text] + field set. + + If you want to annotate the training phrase, you must create + multiple parts, where the fields of each part are populated + in one of two ways: + + - ``Part.text`` is set to a part of the phrase that has no + parameters. + - ``Part.text`` is set to a part of the phrase that you + want to annotate, and the ``entity_type``, ``alias``, and + ``user_defined`` fields are all set. + times_added_count (int): + Optional. Indicates how many times this + example was added to the intent. Each time a + developer adds an existing sample by editing an + intent or training, this counter is increased. + """ + + class Type(proto.Enum): + r"""Represents different types of training phrases.""" + TYPE_UNSPECIFIED = 0 + EXAMPLE = 1 + TEMPLATE = 2 + + class Part(proto.Message): + r"""Represents a part of a training phrase. + + Attributes: + text (str): + Required. The text for this part. + entity_type (str): + Optional. The entity type name prefixed with ``@``. This + field is required for annotated parts of the training + phrase. + alias (str): + Optional. The parameter name for the value + extracted from the annotated part of the + example. This field is required for annotated + parts of the training phrase. + user_defined (bool): + Optional. Indicates whether the text was + manually annotated. This field is set to true + when the Dialogflow Console is used to manually + annotate the part. When creating an annotated + part with the API, you must set this to true. + """ + + text = proto.Field(proto.STRING, number=1) + + entity_type = proto.Field(proto.STRING, number=2) + + alias = proto.Field(proto.STRING, number=3) + + user_defined = proto.Field(proto.BOOL, number=4) + + name = proto.Field(proto.STRING, number=1) + + type_ = proto.Field(proto.ENUM, number=2, enum="Intent.TrainingPhrase.Type",) + + parts = proto.RepeatedField( + proto.MESSAGE, number=3, message="Intent.TrainingPhrase.Part", + ) + + times_added_count = proto.Field(proto.INT32, number=4) + + class Parameter(proto.Message): + r"""Represents intent parameters. + + Attributes: + name (str): + The unique identifier of this parameter. + display_name (str): + Required. The name of the parameter. + value (str): + Optional. The definition of the parameter value. It can be: + + - a constant string, + - a parameter value defined as ``$parameter_name``, + - an original parameter value defined as + ``$parameter_name.original``, + - a parameter value from some context defined as + ``#context_name.parameter_name``. + default_value (str): + Optional. The default value to use when the ``value`` yields + an empty result. Default values can be extracted from + contexts by using the following syntax: + ``#context_name.parameter_name``. + entity_type_display_name (str): + Optional. The name of the entity type, prefixed with ``@``, + that describes values of the parameter. If the parameter is + required, this must be provided. + mandatory (bool): + Optional. Indicates whether the parameter is + required. That is, whether the intent cannot be + completed without collecting the parameter + value. + prompts (Sequence[str]): + Optional. The collection of prompts that the + agent can present to the user in order to + collect a value for the parameter. + is_list (bool): + Optional. Indicates whether the parameter + represents a list of values. + """ + + name = proto.Field(proto.STRING, number=1) + + display_name = proto.Field(proto.STRING, number=2) + + value = proto.Field(proto.STRING, number=3) + + default_value = proto.Field(proto.STRING, number=4) + + entity_type_display_name = proto.Field(proto.STRING, number=5) + + mandatory = proto.Field(proto.BOOL, number=6) + + prompts = proto.RepeatedField(proto.STRING, number=7) + + is_list = proto.Field(proto.BOOL, number=8) + + class Message(proto.Message): + r"""Corresponds to the ``Response`` field in the Dialogflow console. + + Attributes: + text (~.gcd_intent.Intent.Message.Text): + Returns a text response. + image (~.gcd_intent.Intent.Message.Image): + Displays an image. + quick_replies (~.gcd_intent.Intent.Message.QuickReplies): + Displays quick replies. + card (~.gcd_intent.Intent.Message.Card): + Displays a card. + payload (~.struct.Struct): + A custom platform-specific response. + simple_responses (~.gcd_intent.Intent.Message.SimpleResponses): + Returns a voice or text-only response for + Actions on Google. + basic_card (~.gcd_intent.Intent.Message.BasicCard): + Displays a basic card for Actions on Google. + suggestions (~.gcd_intent.Intent.Message.Suggestions): + Displays suggestion chips for Actions on + Google. + link_out_suggestion (~.gcd_intent.Intent.Message.LinkOutSuggestion): + Displays a link out suggestion chip for + Actions on Google. + list_select (~.gcd_intent.Intent.Message.ListSelect): + Displays a list card for Actions on Google. + carousel_select (~.gcd_intent.Intent.Message.CarouselSelect): + Displays a carousel card for Actions on + Google. + telephony_play_audio (~.gcd_intent.Intent.Message.TelephonyPlayAudio): + Plays audio from a file in Telephony Gateway. + telephony_synthesize_speech (~.gcd_intent.Intent.Message.TelephonySynthesizeSpeech): + Synthesizes speech in Telephony Gateway. + telephony_transfer_call (~.gcd_intent.Intent.Message.TelephonyTransferCall): + Transfers the call in Telephony Gateway. + rbm_text (~.gcd_intent.Intent.Message.RbmText): + Rich Business Messaging (RBM) text response. + RBM allows businesses to send enriched and + branded versions of SMS. See + https://jibe.google.com/business-messaging. + rbm_standalone_rich_card (~.gcd_intent.Intent.Message.RbmStandaloneCard): + Standalone Rich Business Messaging (RBM) rich + card response. + rbm_carousel_rich_card (~.gcd_intent.Intent.Message.RbmCarouselCard): + Rich Business Messaging (RBM) carousel rich + card response. + browse_carousel_card (~.gcd_intent.Intent.Message.BrowseCarouselCard): + Browse carousel card for Actions on Google. + table_card (~.gcd_intent.Intent.Message.TableCard): + Table card for Actions on Google. + media_content (~.gcd_intent.Intent.Message.MediaContent): + The media content card for Actions on Google. + platform (~.gcd_intent.Intent.Message.Platform): + Optional. The platform that this message is + intended for. + """ + + class Platform(proto.Enum): + r"""Represents different platforms that a rich message can be + intended for. + """ + PLATFORM_UNSPECIFIED = 0 + FACEBOOK = 1 + SLACK = 2 + TELEGRAM = 3 + KIK = 4 + SKYPE = 5 + LINE = 6 + VIBER = 7 + ACTIONS_ON_GOOGLE = 8 + TELEPHONY = 10 + GOOGLE_HANGOUTS = 11 + + class Text(proto.Message): + r"""The text response message. + + Attributes: + text (Sequence[str]): + Optional. The collection of the agent's + responses. + """ + + text = proto.RepeatedField(proto.STRING, number=1) + + class Image(proto.Message): + r"""The image response message. + + Attributes: + image_uri (str): + Optional. The public URI to an image file. + accessibility_text (str): + A text description of the image to be used for + accessibility, e.g., screen readers. Required if image_uri + is set for CarouselSelect. + """ + + image_uri = proto.Field(proto.STRING, number=1) + + accessibility_text = proto.Field(proto.STRING, number=2) + + class QuickReplies(proto.Message): + r"""The quick replies response message. + + Attributes: + title (str): + Optional. The title of the collection of + quick replies. + quick_replies (Sequence[str]): + Optional. The collection of quick replies. + """ + + title = proto.Field(proto.STRING, number=1) + + quick_replies = proto.RepeatedField(proto.STRING, number=2) + + class Card(proto.Message): + r"""The card response message. + + Attributes: + title (str): + Optional. The title of the card. + subtitle (str): + Optional. The subtitle of the card. + image_uri (str): + Optional. The public URI to an image file for + the card. + buttons (Sequence[~.gcd_intent.Intent.Message.Card.Button]): + Optional. The collection of card buttons. + """ + + class Button(proto.Message): + r"""Optional. Contains information about a button. + + Attributes: + text (str): + Optional. The text to show on the button. + postback (str): + Optional. The text to send back to the + Dialogflow API or a URI to open. + """ + + text = proto.Field(proto.STRING, number=1) + + postback = proto.Field(proto.STRING, number=2) + + title = proto.Field(proto.STRING, number=1) + + subtitle = proto.Field(proto.STRING, number=2) + + image_uri = proto.Field(proto.STRING, number=3) + + buttons = proto.RepeatedField( + proto.MESSAGE, number=4, message="Intent.Message.Card.Button", + ) + + class SimpleResponse(proto.Message): + r"""The simple response message containing speech or text. + + Attributes: + text_to_speech (str): + One of text_to_speech or ssml must be provided. The plain + text of the speech output. Mutually exclusive with ssml. + ssml (str): + One of text_to_speech or ssml must be provided. Structured + spoken response to the user in the SSML format. Mutually + exclusive with text_to_speech. + display_text (str): + Optional. The text to display. + """ + + text_to_speech = proto.Field(proto.STRING, number=1) + + ssml = proto.Field(proto.STRING, number=2) + + display_text = proto.Field(proto.STRING, number=3) + + class SimpleResponses(proto.Message): + r"""The collection of simple response candidates. This message in + ``QueryResult.fulfillment_messages`` and + ``WebhookResponse.fulfillment_messages`` should contain only one + ``SimpleResponse``. + + Attributes: + simple_responses (Sequence[~.gcd_intent.Intent.Message.SimpleResponse]): + Required. The list of simple responses. + """ + + simple_responses = proto.RepeatedField( + proto.MESSAGE, number=1, message="Intent.Message.SimpleResponse", + ) + + class BasicCard(proto.Message): + r"""The basic card message. Useful for displaying information. + + Attributes: + title (str): + Optional. The title of the card. + subtitle (str): + Optional. The subtitle of the card. + formatted_text (str): + Required, unless image is present. The body + text of the card. + image (~.gcd_intent.Intent.Message.Image): + Optional. The image for the card. + buttons (Sequence[~.gcd_intent.Intent.Message.BasicCard.Button]): + Optional. The collection of card buttons. + """ + + class Button(proto.Message): + r"""The button object that appears at the bottom of a card. + + Attributes: + title (str): + Required. The title of the button. + open_uri_action (~.gcd_intent.Intent.Message.BasicCard.Button.OpenUriAction): + Required. Action to take when a user taps on + the button. + """ + + class OpenUriAction(proto.Message): + r"""Opens the given URI. + + Attributes: + uri (str): + Required. The HTTP or HTTPS scheme URI. + """ + + uri = proto.Field(proto.STRING, number=1) + + title = proto.Field(proto.STRING, number=1) + + open_uri_action = proto.Field( + proto.MESSAGE, + number=2, + message="Intent.Message.BasicCard.Button.OpenUriAction", + ) + + title = proto.Field(proto.STRING, number=1) + + subtitle = proto.Field(proto.STRING, number=2) + + formatted_text = proto.Field(proto.STRING, number=3) + + image = proto.Field( + proto.MESSAGE, number=4, message="Intent.Message.Image", + ) + + buttons = proto.RepeatedField( + proto.MESSAGE, number=5, message="Intent.Message.BasicCard.Button", + ) + + class Suggestion(proto.Message): + r"""The suggestion chip message that the user can tap to quickly + post a reply to the conversation. + + Attributes: + title (str): + Required. The text shown the in the + suggestion chip. + """ + + title = proto.Field(proto.STRING, number=1) + + class Suggestions(proto.Message): + r"""The collection of suggestions. + + Attributes: + suggestions (Sequence[~.gcd_intent.Intent.Message.Suggestion]): + Required. The list of suggested replies. + """ + + suggestions = proto.RepeatedField( + proto.MESSAGE, number=1, message="Intent.Message.Suggestion", + ) + + class LinkOutSuggestion(proto.Message): + r"""The suggestion chip message that allows the user to jump out + to the app or website associated with this agent. + + Attributes: + destination_name (str): + Required. The name of the app or site this + chip is linking to. + uri (str): + Required. The URI of the app or site to open + when the user taps the suggestion chip. + """ + + destination_name = proto.Field(proto.STRING, number=1) + + uri = proto.Field(proto.STRING, number=2) + + class ListSelect(proto.Message): + r"""The card for presenting a list of options to select from. + + Attributes: + title (str): + Optional. The overall title of the list. + items (Sequence[~.gcd_intent.Intent.Message.ListSelect.Item]): + Required. List items. + subtitle (str): + Optional. Subtitle of the list. + """ + + class Item(proto.Message): + r"""An item in the list. + + Attributes: + info (~.gcd_intent.Intent.Message.SelectItemInfo): + Required. Additional information about this + option. + title (str): + Required. The title of the list item. + description (str): + Optional. The main text describing the item. + image (~.gcd_intent.Intent.Message.Image): + Optional. The image to display. + """ + + info = proto.Field( + proto.MESSAGE, number=1, message="Intent.Message.SelectItemInfo", + ) + + title = proto.Field(proto.STRING, number=2) + + description = proto.Field(proto.STRING, number=3) + + image = proto.Field( + proto.MESSAGE, number=4, message="Intent.Message.Image", + ) + + title = proto.Field(proto.STRING, number=1) + + items = proto.RepeatedField( + proto.MESSAGE, number=2, message="Intent.Message.ListSelect.Item", + ) + + subtitle = proto.Field(proto.STRING, number=3) + + class CarouselSelect(proto.Message): + r"""The card for presenting a carousel of options to select from. + + Attributes: + items (Sequence[~.gcd_intent.Intent.Message.CarouselSelect.Item]): + Required. Carousel items. + """ + + class Item(proto.Message): + r"""An item in the carousel. + + Attributes: + info (~.gcd_intent.Intent.Message.SelectItemInfo): + Required. Additional info about the option + item. + title (str): + Required. Title of the carousel item. + description (str): + Optional. The body text of the card. + image (~.gcd_intent.Intent.Message.Image): + Optional. The image to display. + """ + + info = proto.Field( + proto.MESSAGE, number=1, message="Intent.Message.SelectItemInfo", + ) + + title = proto.Field(proto.STRING, number=2) + + description = proto.Field(proto.STRING, number=3) + + image = proto.Field( + proto.MESSAGE, number=4, message="Intent.Message.Image", + ) + + items = proto.RepeatedField( + proto.MESSAGE, number=1, message="Intent.Message.CarouselSelect.Item", + ) + + class SelectItemInfo(proto.Message): + r"""Additional info about the select item for when it is + triggered in a dialog. + + Attributes: + key (str): + Required. A unique key that will be sent back + to the agent if this response is given. + synonyms (Sequence[str]): + Optional. A list of synonyms that can also be + used to trigger this item in dialog. + """ + + key = proto.Field(proto.STRING, number=1) + + synonyms = proto.RepeatedField(proto.STRING, number=2) + + class TelephonyPlayAudio(proto.Message): + r"""Plays audio from a file in Telephony Gateway. + + Attributes: + audio_uri (str): + Required. URI to a Google Cloud Storage object containing + the audio to play, e.g., "gs://bucket/object". The object + must contain a single channel (mono) of linear PCM audio (2 + bytes / sample) at 8kHz. + + This object must be readable by the + ``service-@gcp-sa-dialogflow.iam.gserviceaccount.com`` + service account where is the number of the Telephony Gateway + project (usually the same as the Dialogflow agent project). + If the Google Cloud Storage bucket is in the Telephony + Gateway project, this permission is added by default when + enabling the Dialogflow V2 API. + + For audio from other sources, consider using the + ``TelephonySynthesizeSpeech`` message with SSML. + """ + + audio_uri = proto.Field(proto.STRING, number=1) + + class TelephonySynthesizeSpeech(proto.Message): + r"""Synthesizes speech and plays back the synthesized audio to the + caller in Telephony Gateway. + + Telephony Gateway takes the synthesizer settings from + ``DetectIntentResponse.output_audio_config`` which can either be set + at request-level or can come from the agent-level synthesizer + config. + + Attributes: + text (str): + The raw text to be synthesized. + ssml (str): + The SSML to be synthesized. For more information, see + `SSML `__. + """ + + text = proto.Field(proto.STRING, number=1, oneof="source") + + ssml = proto.Field(proto.STRING, number=2, oneof="source") + + class TelephonyTransferCall(proto.Message): + r"""Transfers the call in Telephony Gateway. + + Attributes: + phone_number (str): + Required. The phone number to transfer the call to in `E.164 + format `__. + + We currently only allow transferring to US numbers + (+1xxxyyyzzzz). + """ + + phone_number = proto.Field(proto.STRING, number=1) + + class RbmText(proto.Message): + r"""Rich Business Messaging (RBM) text response with suggestions. + + Attributes: + text (str): + Required. Text sent and displayed to the + user. + rbm_suggestion (Sequence[~.gcd_intent.Intent.Message.RbmSuggestion]): + Optional. One or more suggestions to show to + the user. + """ + + text = proto.Field(proto.STRING, number=1) + + rbm_suggestion = proto.RepeatedField( + proto.MESSAGE, number=2, message="Intent.Message.RbmSuggestion", + ) + + class RbmCarouselCard(proto.Message): + r"""Carousel Rich Business Messaging (RBM) rich card. + + Rich cards allow you to respond to users with more vivid content, + e.g. with media and suggestions. + + If you want to show a single card with more control over the layout, + please use + [RbmStandaloneCard][google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard] + instead. + + Attributes: + card_width (~.gcd_intent.Intent.Message.RbmCarouselCard.CardWidth): + Required. The width of the cards in the + carousel. + card_contents (Sequence[~.gcd_intent.Intent.Message.RbmCardContent]): + Required. The cards in the carousel. A + carousel must have at least 2 cards and at most + 10. + """ + + class CardWidth(proto.Enum): + r"""The width of the cards in the carousel.""" + CARD_WIDTH_UNSPECIFIED = 0 + SMALL = 1 + MEDIUM = 2 + + card_width = proto.Field( + proto.ENUM, number=1, enum="Intent.Message.RbmCarouselCard.CardWidth", + ) + + card_contents = proto.RepeatedField( + proto.MESSAGE, number=2, message="Intent.Message.RbmCardContent", + ) + + class RbmStandaloneCard(proto.Message): + r"""Standalone Rich Business Messaging (RBM) rich card. + + Rich cards allow you to respond to users with more vivid content, + e.g. with media and suggestions. + + You can group multiple rich cards into one using + [RbmCarouselCard][google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard] + but carousel cards will give you less control over the card layout. + + Attributes: + card_orientation (~.gcd_intent.Intent.Message.RbmStandaloneCard.CardOrientation): + Required. Orientation of the card. + thumbnail_image_alignment (~.gcd_intent.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment): + Required if orientation is horizontal. + Image preview alignment for standalone cards + with horizontal layout. + card_content (~.gcd_intent.Intent.Message.RbmCardContent): + Required. Card content. + """ + + class CardOrientation(proto.Enum): + r"""Orientation of the card.""" + CARD_ORIENTATION_UNSPECIFIED = 0 + HORIZONTAL = 1 + VERTICAL = 2 + + class ThumbnailImageAlignment(proto.Enum): + r"""Thumbnail preview alignment for standalone cards with + horizontal layout. + """ + THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED = 0 + LEFT = 1 + RIGHT = 2 + + card_orientation = proto.Field( + proto.ENUM, + number=1, + enum="Intent.Message.RbmStandaloneCard.CardOrientation", + ) + + thumbnail_image_alignment = proto.Field( + proto.ENUM, + number=2, + enum="Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment", + ) + + card_content = proto.Field( + proto.MESSAGE, number=3, message="Intent.Message.RbmCardContent", + ) + + class RbmCardContent(proto.Message): + r"""Rich Business Messaging (RBM) Card content + + Attributes: + title (str): + Optional. Title of the card (at most 200 + bytes). + At least one of the title, description or media + must be set. + description (str): + Optional. Description of the card (at most + 2000 bytes). + At least one of the title, description or media + must be set. + media (~.gcd_intent.Intent.Message.RbmCardContent.RbmMedia): + Optional. However at least one of the title, + description or media must be set. Media (image, + GIF or a video) to include in the card. + suggestions (Sequence[~.gcd_intent.Intent.Message.RbmSuggestion]): + Optional. List of suggestions to include in + the card. + """ + + class RbmMedia(proto.Message): + r"""Rich Business Messaging (RBM) Media displayed in Cards The following + media-types are currently supported: + + Image Types + + - image/jpeg + - image/jpg' + - image/gif + - image/png + + Video Types + + - video/h263 + - video/m4v + - video/mp4 + - video/mpeg + - video/mpeg4 + - video/webm + + Attributes: + file_uri (str): + Required. Publicly reachable URI of the file. + The RBM platform determines the MIME type of the + file from the content-type field in the HTTP + headers when the platform fetches the file. The + content-type field must be present and accurate + in the HTTP response from the URL. + thumbnail_uri (str): + Optional. Publicly reachable URI of the + thumbnail.If you don't provide a thumbnail URI, + the RBM platform displays a blank placeholder + thumbnail until the user's device downloads the + file. Depending on the user's setting, the file + may not download automatically and may require + the user to tap a download button. + height (~.gcd_intent.Intent.Message.RbmCardContent.RbmMedia.Height): + Required for cards with vertical orientation. + The height of the media within a rich card with + a vertical layout. For a standalone card with + horizontal layout, height is not customizable, + and this field is ignored. + """ + + class Height(proto.Enum): + r"""Media height""" + HEIGHT_UNSPECIFIED = 0 + SHORT = 1 + MEDIUM = 2 + TALL = 3 + + file_uri = proto.Field(proto.STRING, number=1) + + thumbnail_uri = proto.Field(proto.STRING, number=2) + + height = proto.Field( + proto.ENUM, + number=3, + enum="Intent.Message.RbmCardContent.RbmMedia.Height", + ) + + title = proto.Field(proto.STRING, number=1) + + description = proto.Field(proto.STRING, number=2) + + media = proto.Field( + proto.MESSAGE, + number=3, + message="Intent.Message.RbmCardContent.RbmMedia", + ) + + suggestions = proto.RepeatedField( + proto.MESSAGE, number=4, message="Intent.Message.RbmSuggestion", + ) + + class RbmSuggestion(proto.Message): + r"""Rich Business Messaging (RBM) suggestion. Suggestions allow + user to easily select/click a predefined response or perform an + action (like opening a web uri). + + Attributes: + reply (~.gcd_intent.Intent.Message.RbmSuggestedReply): + Predefined replies for user to select instead + of typing + action (~.gcd_intent.Intent.Message.RbmSuggestedAction): + Predefined client side actions that user can + choose + """ + + reply = proto.Field( + proto.MESSAGE, + number=1, + oneof="suggestion", + message="Intent.Message.RbmSuggestedReply", + ) + + action = proto.Field( + proto.MESSAGE, + number=2, + oneof="suggestion", + message="Intent.Message.RbmSuggestedAction", + ) + + class RbmSuggestedReply(proto.Message): + r"""Rich Business Messaging (RBM) suggested reply that the user + can click instead of typing in their own response. + + Attributes: + text (str): + Suggested reply text. + postback_data (str): + Opaque payload that the Dialogflow receives + in a user event when the user taps the suggested + reply. This data will be also forwarded to + webhook to allow performing custom business + logic. + """ + + text = proto.Field(proto.STRING, number=1) + + postback_data = proto.Field(proto.STRING, number=2) + + class RbmSuggestedAction(proto.Message): + r"""Rich Business Messaging (RBM) suggested client-side action + that the user can choose from the card. + + Attributes: + text (str): + Text to display alongside the action. + postback_data (str): + Opaque payload that the Dialogflow receives + in a user event when the user taps the suggested + action. This data will be also forwarded to + webhook to allow performing custom business + logic. + dial (~.gcd_intent.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial): + Suggested client side action: Dial a phone + number + open_url (~.gcd_intent.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri): + Suggested client side action: Open a URI on + device + share_location (~.gcd_intent.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation): + Suggested client side action: Share user + location + """ + + class RbmSuggestedActionDial(proto.Message): + r"""Opens the user's default dialer app with the specified phone + number but does not dial automatically. + + Attributes: + phone_number (str): + Required. The phone number to fill in the default dialer + app. This field should be in + `E.164 `__ format. An + example of a correctly formatted phone number: +15556767888. + """ + + phone_number = proto.Field(proto.STRING, number=1) + + class RbmSuggestedActionOpenUri(proto.Message): + r"""Opens the user's default web browser app to the specified uri + If the user has an app installed that is + registered as the default handler for the URL, then this app + will be opened instead, and its icon will be used in the + suggested action UI. + + Attributes: + uri (str): + Required. The uri to open on the user device + """ + + uri = proto.Field(proto.STRING, number=1) + + class RbmSuggestedActionShareLocation(proto.Message): + r"""Opens the device's location chooser so the user can pick a + location to send back to the agent. + """ + + text = proto.Field(proto.STRING, number=1) + + postback_data = proto.Field(proto.STRING, number=2) + + dial = proto.Field( + proto.MESSAGE, + number=3, + oneof="action", + message="Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial", + ) + + open_url = proto.Field( + proto.MESSAGE, + number=4, + oneof="action", + message="Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri", + ) + + share_location = proto.Field( + proto.MESSAGE, + number=5, + oneof="action", + message="Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation", + ) + + class MediaContent(proto.Message): + r"""The media content card for Actions on Google. + + Attributes: + media_type (~.gcd_intent.Intent.Message.MediaContent.ResponseMediaType): + Optional. What type of media is the content + (ie "audio"). + media_objects (Sequence[~.gcd_intent.Intent.Message.MediaContent.ResponseMediaObject]): + Required. List of media objects. + """ + + class ResponseMediaType(proto.Enum): + r"""Format of response media type.""" + RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0 + AUDIO = 1 + + class ResponseMediaObject(proto.Message): + r"""Response media object for media content card. + + Attributes: + name (str): + Required. Name of media card. + description (str): + Optional. Description of media card. + large_image (~.gcd_intent.Intent.Message.Image): + Optional. Image to display above media + content. + icon (~.gcd_intent.Intent.Message.Image): + Optional. Icon to display above media + content. + content_url (str): + Required. Url where the media is stored. + """ + + name = proto.Field(proto.STRING, number=1) + + description = proto.Field(proto.STRING, number=2) + + large_image = proto.Field( + proto.MESSAGE, + number=3, + oneof="image", + message="Intent.Message.Image", + ) + + icon = proto.Field( + proto.MESSAGE, + number=4, + oneof="image", + message="Intent.Message.Image", + ) + + content_url = proto.Field(proto.STRING, number=5) + + media_type = proto.Field( + proto.ENUM, + number=1, + enum="Intent.Message.MediaContent.ResponseMediaType", + ) + + media_objects = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Intent.Message.MediaContent.ResponseMediaObject", + ) + + class BrowseCarouselCard(proto.Message): + r"""Browse Carousel Card for Actions on Google. + https://developers.google.com/actions/assistant/responses#browsing_carousel + + Attributes: + items (Sequence[~.gcd_intent.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem]): + Required. List of items in the Browse + Carousel Card. Minimum of two items, maximum of + ten. + image_display_options (~.gcd_intent.Intent.Message.BrowseCarouselCard.ImageDisplayOptions): + Optional. Settings for displaying the image. Applies to + every image in + [items][google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.items]. + """ + + class ImageDisplayOptions(proto.Enum): + r"""Image display options for Actions on Google. This should be + used for when the image's aspect ratio does not match the image + container's aspect ratio. + """ + IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0 + GRAY = 1 + WHITE = 2 + CROPPED = 3 + BLURRED_BACKGROUND = 4 + + class BrowseCarouselCardItem(proto.Message): + r"""Browsing carousel tile + + Attributes: + open_uri_action (~.gcd_intent.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction): + Required. Action to present to the user. + title (str): + Required. Title of the carousel item. Maximum + of two lines of text. + description (str): + Optional. Description of the carousel item. + Maximum of four lines of text. + image (~.gcd_intent.Intent.Message.Image): + Optional. Hero image for the carousel item. + footer (str): + Optional. Text that appears at the bottom of + the Browse Carousel Card. Maximum of one line of + text. + """ + + class OpenUrlAction(proto.Message): + r"""Actions on Google action to open a given url. + + Attributes: + url (str): + Required. URL + url_type_hint (~.gcd_intent.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint): + Optional. Specifies the type of viewer that + is used when opening the URL. Defaults to + opening via web browser. + """ + + class UrlTypeHint(proto.Enum): + r"""Type of the URI.""" + URL_TYPE_HINT_UNSPECIFIED = 0 + AMP_ACTION = 1 + AMP_CONTENT = 2 + + url = proto.Field(proto.STRING, number=1) + + url_type_hint = proto.Field( + proto.ENUM, + number=3, + enum="Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint", + ) + + open_uri_action = proto.Field( + proto.MESSAGE, + number=1, + message="Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction", + ) + + title = proto.Field(proto.STRING, number=2) + + description = proto.Field(proto.STRING, number=3) + + image = proto.Field( + proto.MESSAGE, number=4, message="Intent.Message.Image", + ) + + footer = proto.Field(proto.STRING, number=5) + + items = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem", + ) + + image_display_options = proto.Field( + proto.ENUM, + number=2, + enum="Intent.Message.BrowseCarouselCard.ImageDisplayOptions", + ) + + class TableCard(proto.Message): + r"""Table card for Actions on Google. + + Attributes: + title (str): + Required. Title of the card. + subtitle (str): + Optional. Subtitle to the title. + image (~.gcd_intent.Intent.Message.Image): + Optional. Image which should be displayed on + the card. + column_properties (Sequence[~.gcd_intent.Intent.Message.ColumnProperties]): + Optional. Display properties for the columns + in this table. + rows (Sequence[~.gcd_intent.Intent.Message.TableCardRow]): + Optional. Rows in this table of data. + buttons (Sequence[~.gcd_intent.Intent.Message.BasicCard.Button]): + Optional. List of buttons for the card. + """ + + title = proto.Field(proto.STRING, number=1) + + subtitle = proto.Field(proto.STRING, number=2) + + image = proto.Field( + proto.MESSAGE, number=3, message="Intent.Message.Image", + ) + + column_properties = proto.RepeatedField( + proto.MESSAGE, number=4, message="Intent.Message.ColumnProperties", + ) + + rows = proto.RepeatedField( + proto.MESSAGE, number=5, message="Intent.Message.TableCardRow", + ) + + buttons = proto.RepeatedField( + proto.MESSAGE, number=6, message="Intent.Message.BasicCard.Button", + ) + + class ColumnProperties(proto.Message): + r"""Column properties for + [TableCard][google.cloud.dialogflow.v2beta1.Intent.Message.TableCard]. + + Attributes: + header (str): + Required. Column heading. + horizontal_alignment (~.gcd_intent.Intent.Message.ColumnProperties.HorizontalAlignment): + Optional. Defines text alignment for all + cells in this column. + """ + + class HorizontalAlignment(proto.Enum): + r"""Text alignments within a cell.""" + HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0 + LEADING = 1 + CENTER = 2 + TRAILING = 3 + + header = proto.Field(proto.STRING, number=1) + + horizontal_alignment = proto.Field( + proto.ENUM, + number=2, + enum="Intent.Message.ColumnProperties.HorizontalAlignment", + ) + + class TableCardRow(proto.Message): + r"""Row of + [TableCard][google.cloud.dialogflow.v2beta1.Intent.Message.TableCard]. + + Attributes: + cells (Sequence[~.gcd_intent.Intent.Message.TableCardCell]): + Optional. List of cells that make up this + row. + divider_after (bool): + Optional. Whether to add a visual divider + after this row. + """ + + cells = proto.RepeatedField( + proto.MESSAGE, number=1, message="Intent.Message.TableCardCell", + ) + + divider_after = proto.Field(proto.BOOL, number=2) + + class TableCardCell(proto.Message): + r"""Cell of + [TableCardRow][google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow]. + + Attributes: + text (str): + Required. Text in this cell. + """ + + text = proto.Field(proto.STRING, number=1) + + text = proto.Field( + proto.MESSAGE, number=1, oneof="message", message="Intent.Message.Text", + ) + + image = proto.Field( + proto.MESSAGE, number=2, oneof="message", message="Intent.Message.Image", + ) + + quick_replies = proto.Field( + proto.MESSAGE, + number=3, + oneof="message", + message="Intent.Message.QuickReplies", + ) + + card = proto.Field( + proto.MESSAGE, number=4, oneof="message", message="Intent.Message.Card", + ) + + payload = proto.Field( + proto.MESSAGE, number=5, oneof="message", message=struct.Struct, + ) + + simple_responses = proto.Field( + proto.MESSAGE, + number=7, + oneof="message", + message="Intent.Message.SimpleResponses", + ) + + basic_card = proto.Field( + proto.MESSAGE, + number=8, + oneof="message", + message="Intent.Message.BasicCard", + ) + + suggestions = proto.Field( + proto.MESSAGE, + number=9, + oneof="message", + message="Intent.Message.Suggestions", + ) + + link_out_suggestion = proto.Field( + proto.MESSAGE, + number=10, + oneof="message", + message="Intent.Message.LinkOutSuggestion", + ) + + list_select = proto.Field( + proto.MESSAGE, + number=11, + oneof="message", + message="Intent.Message.ListSelect", + ) + + carousel_select = proto.Field( + proto.MESSAGE, + number=12, + oneof="message", + message="Intent.Message.CarouselSelect", + ) + + telephony_play_audio = proto.Field( + proto.MESSAGE, + number=13, + oneof="message", + message="Intent.Message.TelephonyPlayAudio", + ) + + telephony_synthesize_speech = proto.Field( + proto.MESSAGE, + number=14, + oneof="message", + message="Intent.Message.TelephonySynthesizeSpeech", + ) + + telephony_transfer_call = proto.Field( + proto.MESSAGE, + number=15, + oneof="message", + message="Intent.Message.TelephonyTransferCall", + ) + + rbm_text = proto.Field( + proto.MESSAGE, number=18, oneof="message", message="Intent.Message.RbmText", + ) + + rbm_standalone_rich_card = proto.Field( + proto.MESSAGE, + number=19, + oneof="message", + message="Intent.Message.RbmStandaloneCard", + ) + + rbm_carousel_rich_card = proto.Field( + proto.MESSAGE, + number=20, + oneof="message", + message="Intent.Message.RbmCarouselCard", + ) + + browse_carousel_card = proto.Field( + proto.MESSAGE, + number=22, + oneof="message", + message="Intent.Message.BrowseCarouselCard", + ) + + table_card = proto.Field( + proto.MESSAGE, + number=23, + oneof="message", + message="Intent.Message.TableCard", + ) + + media_content = proto.Field( + proto.MESSAGE, + number=24, + oneof="message", + message="Intent.Message.MediaContent", + ) + + platform = proto.Field(proto.ENUM, number=6, enum="Intent.Message.Platform",) + + class FollowupIntentInfo(proto.Message): + r"""Represents a single followup intent in the chain. + + Attributes: + followup_intent_name (str): + The unique identifier of the followup intent. Format: + ``projects//agent/intents/``. + parent_followup_intent_name (str): + The unique identifier of the followup intent's parent. + Format: ``projects//agent/intents/``. + """ + + followup_intent_name = proto.Field(proto.STRING, number=1) + + parent_followup_intent_name = proto.Field(proto.STRING, number=2) + + name = proto.Field(proto.STRING, number=1) + + display_name = proto.Field(proto.STRING, number=2) + + webhook_state = proto.Field(proto.ENUM, number=6, enum=WebhookState,) + + priority = proto.Field(proto.INT32, number=3) + + is_fallback = proto.Field(proto.BOOL, number=4) + + ml_enabled = proto.Field(proto.BOOL, number=5) + + ml_disabled = proto.Field(proto.BOOL, number=19) + + end_interaction = proto.Field(proto.BOOL, number=21) + + input_context_names = proto.RepeatedField(proto.STRING, number=7) + + events = proto.RepeatedField(proto.STRING, number=8) + + training_phrases = proto.RepeatedField( + proto.MESSAGE, number=9, message=TrainingPhrase, + ) + + action = proto.Field(proto.STRING, number=10) + + output_contexts = proto.RepeatedField( + proto.MESSAGE, number=11, message=context.Context, + ) + + reset_contexts = proto.Field(proto.BOOL, number=12) + + parameters = proto.RepeatedField(proto.MESSAGE, number=13, message=Parameter,) + + messages = proto.RepeatedField(proto.MESSAGE, number=14, message=Message,) + + default_response_platforms = proto.RepeatedField( + proto.ENUM, number=15, enum=Message.Platform, + ) + + root_followup_intent_name = proto.Field(proto.STRING, number=16) + + parent_followup_intent_name = proto.Field(proto.STRING, number=17) + + followup_intent_info = proto.RepeatedField( + proto.MESSAGE, number=18, message=FollowupIntentInfo, + ) + + +class ListIntentsRequest(proto.Message): + r"""The request message for + [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. + + Attributes: + parent (str): + Required. The agent to list all intents from. Format: + ``projects//agent``. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + intent_view (~.gcd_intent.IntentView): + Optional. The resource view to apply to the + returned intent. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list request. + """ + + parent = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=2) + + intent_view = proto.Field(proto.ENUM, number=3, enum="IntentView",) + + page_size = proto.Field(proto.INT32, number=4) + + page_token = proto.Field(proto.STRING, number=5) + + +class ListIntentsResponse(proto.Message): + r"""The response message for + [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. + + Attributes: + intents (Sequence[~.gcd_intent.Intent]): + The list of agent intents. There will be a maximum number of + items returned based on the page_size field in the request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + intents = proto.RepeatedField(proto.MESSAGE, number=1, message="Intent",) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class GetIntentRequest(proto.Message): + r"""The request message for + [Intents.GetIntent][google.cloud.dialogflow.v2beta1.Intents.GetIntent]. + + Attributes: + name (str): + Required. The name of the intent. Supported formats: + + - ``projects//agent/intents/`` + - ``projects//locations//agent/intents/`` + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + intent_view (~.gcd_intent.IntentView): + Optional. The resource view to apply to the + returned intent. + """ + + name = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=2) + + intent_view = proto.Field(proto.ENUM, number=3, enum="IntentView",) + + +class CreateIntentRequest(proto.Message): + r"""The request message for + [Intents.CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent]. + + Attributes: + parent (str): + Required. The agent to create a intent for. Supported + formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + intent (~.gcd_intent.Intent): + Required. The intent to create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + intent_view (~.gcd_intent.IntentView): + Optional. The resource view to apply to the + returned intent. + """ + + parent = proto.Field(proto.STRING, number=1) + + intent = proto.Field(proto.MESSAGE, number=2, message="Intent",) + + language_code = proto.Field(proto.STRING, number=3) + + intent_view = proto.Field(proto.ENUM, number=4, enum="IntentView",) + + +class UpdateIntentRequest(proto.Message): + r"""The request message for + [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent]. + + Attributes: + intent (~.gcd_intent.Intent): + Required. The intent to update. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + intent_view (~.gcd_intent.IntentView): + Optional. The resource view to apply to the + returned intent. + """ + + 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.FieldMask,) + + intent_view = proto.Field(proto.ENUM, number=4, enum="IntentView",) + + +class DeleteIntentRequest(proto.Message): + r"""The request message for + [Intents.DeleteIntent][google.cloud.dialogflow.v2beta1.Intents.DeleteIntent]. + + Attributes: + name (str): + Required. The name of the intent to delete. If this intent + has direct or indirect followup intents, we also delete + them. + + Supported formats: + + - ``projects//agent/intents/`` + - ``projects//locations//agent/intents/`` + """ + + name = proto.Field(proto.STRING, number=1) + + +class BatchUpdateIntentsRequest(proto.Message): + r"""The request message for + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. + + Attributes: + parent (str): + Required. The name of the agent to update or create intents + in. Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + intent_batch_uri (str): + The URI to a Google Cloud Storage file + containing intents to update or create. The file + format can either be a serialized proto (of + IntentBatch type) or JSON object. Note: The URI + must start with "gs://". + intent_batch_inline (~.gcd_intent.IntentBatch): + The collection of intents to update or + create. + language_code (str): + Optional. The language used to access language-specific + data. If not specified, the agent's default language is + used. For more information, see `Multilingual intent and + entity + data `__. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + intent_view (~.gcd_intent.IntentView): + Optional. The resource view to apply to the + returned intent. + """ + + parent = proto.Field(proto.STRING, number=1) + + intent_batch_uri = proto.Field(proto.STRING, number=2, oneof="intent_batch") + + intent_batch_inline = proto.Field( + proto.MESSAGE, number=3, oneof="intent_batch", message="IntentBatch", + ) + + language_code = proto.Field(proto.STRING, number=4) + + update_mask = proto.Field(proto.MESSAGE, number=5, message=field_mask.FieldMask,) + + intent_view = proto.Field(proto.ENUM, number=6, enum="IntentView",) + + +class BatchUpdateIntentsResponse(proto.Message): + r"""The response message for + [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. + + Attributes: + intents (Sequence[~.gcd_intent.Intent]): + The collection of updated or created intents. + """ + + intents = proto.RepeatedField(proto.MESSAGE, number=1, message="Intent",) + + +class BatchDeleteIntentsRequest(proto.Message): + r"""The request message for + [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents]. + + Attributes: + parent (str): + Required. The name of the agent to delete all entities types + for. Supported formats: + + - ``projects//agent`` + - ``projects//locations//agent`` + intents (Sequence[~.gcd_intent.Intent]): + Required. The collection of intents to delete. Only intent + ``name`` must be filled in. + """ + + parent = proto.Field(proto.STRING, number=1) + + intents = proto.RepeatedField(proto.MESSAGE, number=2, message="Intent",) + + +class IntentBatch(proto.Message): + r"""This message is a wrapper around a collection of intents. + + Attributes: + intents (Sequence[~.gcd_intent.Intent]): + A collection of intents. + """ + + intents = proto.RepeatedField(proto.MESSAGE, number=1, message="Intent",) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/knowledge_base.py b/google/cloud/dialogflow_v2beta1/types/knowledge_base.py new file mode 100644 index 000000000..220e6ff22 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/knowledge_base.py @@ -0,0 +1,219 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={ + "KnowledgeBase", + "ListKnowledgeBasesRequest", + "ListKnowledgeBasesResponse", + "GetKnowledgeBaseRequest", + "CreateKnowledgeBaseRequest", + "DeleteKnowledgeBaseRequest", + "UpdateKnowledgeBaseRequest", + }, +) + + +class KnowledgeBase(proto.Message): + r"""A knowledge base represents a collection of knowledge documents that + you provide to Dialogflow. Your knowledge documents contain + information that may be useful during conversations with end-users. + Some Dialogflow features use knowledge bases when looking for a + response to an end-user input. + + For more information, see the `knowledge base + guide `__. + + Note: The ``projects.agent.knowledgeBases`` resource is deprecated; + only use ``projects.knowledgeBases``. + + Attributes: + name (str): + The knowledge base resource name. The name must be empty + when creating a knowledge base. Format: + ``projects//locations//knowledgeBases/``. + display_name (str): + Required. The display name of the knowledge + base. The name must be 1024 bytes or less; + otherwise, the creation request fails. + language_code (str): + Language which represents the KnowledgeBase. + When the KnowledgeBase is created/updated, this + is populated for all non en-us languages. If not + populated, the default language en-us applies. + """ + + name = proto.Field(proto.STRING, number=1) + + display_name = proto.Field(proto.STRING, number=2) + + language_code = proto.Field(proto.STRING, number=4) + + +class ListKnowledgeBasesRequest(proto.Message): + r"""Request message for + [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. + + Attributes: + parent (str): + Required. The project to list of knowledge bases for. + Format: ``projects//locations/``. + page_size (int): + The maximum number of items to return in a + single page. By default 10 and at most 100. + page_token (str): + The next_page_token value returned from a previous list + request. + filter (str): + The filter expression used to filter knowledge bases + returned by the list method. The expression has the + following syntax: + + [AND ] ... + + The following fields and operators are supported: + + - display_name with has(:) operator + - language_code with equals(=) operator + + Examples: + + - 'language_code=en-us' matches knowledge bases with en-us + language code. + - 'display_name:articles' matches knowledge bases whose + display name contains "articles". + - 'display_name:"Best Articles"' matches knowledge bases + whose display name contains "Best Articles". + - 'language_code=en-gb AND display_name=articles' matches + all knowledge bases whose display name contains + "articles" and whose language code is "en-gb". + + Note: An empty filter string (i.e. "") is a no-op and will + result in no filtering. + + For more information about filtering, see `API + Filtering `__. + """ + + 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 ListKnowledgeBasesResponse(proto.Message): + r"""Response message for + [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. + + Attributes: + knowledge_bases (Sequence[~.gcd_knowledge_base.KnowledgeBase]): + The list of knowledge bases. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + knowledge_bases = proto.RepeatedField( + proto.MESSAGE, number=1, message="KnowledgeBase", + ) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class GetKnowledgeBaseRequest(proto.Message): + r"""Request message for + [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase]. + + Attributes: + name (str): + Required. The name of the knowledge base to retrieve. Format + ``projects//locations//knowledgeBases/``. + """ + + name = proto.Field(proto.STRING, number=1) + + +class CreateKnowledgeBaseRequest(proto.Message): + r"""Request message for + [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase]. + + Attributes: + parent (str): + Required. The project to create a knowledge base for. + Format: ``projects//locations/``. + knowledge_base (~.gcd_knowledge_base.KnowledgeBase): + Required. The knowledge base to create. + """ + + parent = proto.Field(proto.STRING, number=1) + + knowledge_base = proto.Field(proto.MESSAGE, number=2, message="KnowledgeBase",) + + +class DeleteKnowledgeBaseRequest(proto.Message): + r"""Request message for + [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase]. + + Attributes: + name (str): + Required. The name of the knowledge base to delete. Format: + ``projects//locations//knowledgeBases/``. + force (bool): + Optional. Force deletes the knowledge base. + When set to true, any documents in the knowledge + base are also deleted. + """ + + name = proto.Field(proto.STRING, number=1) + + force = proto.Field(proto.BOOL, number=2) + + +class UpdateKnowledgeBaseRequest(proto.Message): + r"""Request message for + [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase]. + + Attributes: + knowledge_base (~.gcd_knowledge_base.KnowledgeBase): + Required. The knowledge base to update. + update_mask (~.field_mask.FieldMask): + Optional. Not specified means ``update all``. Currently, + only ``display_name`` can be updated, an InvalidArgument + will be returned for attempting to update other fields. + """ + + knowledge_base = proto.Field(proto.MESSAGE, number=1, message="KnowledgeBase",) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/session.py b/google/cloud/dialogflow_v2beta1/types/session.py new file mode 100644 index 000000000..6e1bb457f --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/session.py @@ -0,0 +1,975 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.cloud.dialogflow_v2beta1.types import agent +from google.cloud.dialogflow_v2beta1.types import audio_config as gcd_audio_config +from google.cloud.dialogflow_v2beta1.types import context +from google.cloud.dialogflow_v2beta1.types import intent as gcd_intent +from google.cloud.dialogflow_v2beta1.types import session_entity_type +from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import struct_pb2 as struct # type: ignore +from google.rpc import status_pb2 as status # type: ignore +from google.type import latlng_pb2 as latlng # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={ + "DetectIntentRequest", + "DetectIntentResponse", + "QueryParameters", + "QueryInput", + "QueryResult", + "KnowledgeAnswers", + "StreamingDetectIntentRequest", + "StreamingDetectIntentResponse", + "StreamingRecognitionResult", + "TextInput", + "EventInput", + "SentimentAnalysisRequestConfig", + "SentimentAnalysisResult", + "Sentiment", + }, +) + + +class DetectIntentRequest(proto.Message): + r"""The request to detect user's intent. + + Attributes: + session (str): + Required. The name of the session this query is sent to. + Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we are using "-". It's up to the API caller to + choose an appropriate ``Session ID`` and ``User Id``. They + can be a random number or some type of user and session + identifiers (preferably hashed). The length of the + ``Session ID`` and ``User ID`` must not exceed 36 + characters. For more information, see the `API interactions + guide `__. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + query_params (~.gcd_session.QueryParameters): + The parameters of this query. + query_input (~.gcd_session.QueryInput): + Required. The input specification. It can be + set to: + 1. an audio config + which instructs the speech recognizer how to + process the speech audio, + 2. a conversational query in the form of text, + or + 3. an event that specifies which intent to + trigger. + output_audio_config (~.gcd_audio_config.OutputAudioConfig): + Instructs the speech synthesizer how to + generate the output audio. If this field is not + set and agent-level speech synthesizer is not + configured, no output audio is generated. + output_audio_config_mask (~.field_mask.FieldMask): + Mask for + [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] + indicating which settings in this request-level config + should override speech synthesizer settings defined at + agent-level. + + If unspecified or empty, + [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] + replaces the agent-level config in its entirety. + input_audio (bytes): + The natural language speech audio to be processed. This + field should be populated iff ``query_input`` is set to an + input audio config. A single request can contain up to 1 + minute of speech audio data. + """ + + 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=gcd_audio_config.OutputAudioConfig, + ) + + output_audio_config_mask = proto.Field( + proto.MESSAGE, number=7, message=field_mask.FieldMask, + ) + + input_audio = proto.Field(proto.BYTES, number=5) + + +class DetectIntentResponse(proto.Message): + r"""The message returned from the DetectIntent method. + + Attributes: + response_id (str): + The unique identifier of the response. It can + be used to locate a response in the training + example set or for reporting issues. + query_result (~.gcd_session.QueryResult): + The selected results of the conversational query or event + processing. See ``alternative_query_results`` for additional + potential results. + alternative_query_results (Sequence[~.gcd_session.QueryResult]): + If Knowledge Connectors are enabled, there could be more + than one result returned for a given query or event, and + this field will contain all results except for the top one, + which is captured in query_result. The alternative results + are ordered by decreasing + ``QueryResult.intent_detection_confidence``. If Knowledge + Connectors are disabled, this field will be empty until + multiple responses for regular intents are supported, at + which point those additional results will be surfaced here. + webhook_status (~.status.Status): + Specifies the status of the webhook request. + output_audio (bytes): + The audio data bytes encoded as specified in the request. + Note: The output audio is generated based on the values of + default platform text responses found in the + ``query_result.fulfillment_messages`` field. If multiple + default text responses exist, they will be concatenated when + generating audio. If no default platform text responses + exist, the generated audio content will be empty. + + In some scenarios, multiple output audio fields may be + present in the response structure. In these cases, only the + top-most-level audio output has content. + output_audio_config (~.gcd_audio_config.OutputAudioConfig): + The config used by the speech synthesizer to + generate the output audio. + """ + + response_id = proto.Field(proto.STRING, number=1) + + query_result = proto.Field(proto.MESSAGE, number=2, message="QueryResult",) + + alternative_query_results = proto.RepeatedField( + proto.MESSAGE, number=5, message="QueryResult", + ) + + webhook_status = proto.Field(proto.MESSAGE, number=3, message=status.Status,) + + output_audio = proto.Field(proto.BYTES, number=4) + + output_audio_config = proto.Field( + proto.MESSAGE, number=6, message=gcd_audio_config.OutputAudioConfig, + ) + + +class QueryParameters(proto.Message): + r"""Represents the parameters of the conversational query. + + Attributes: + time_zone (str): + The time zone of this conversational query from the `time + zone database `__, e.g., + America/New_York, Europe/Paris. If not provided, the time + zone specified in agent settings is used. + geo_location (~.latlng.LatLng): + The geo location of this conversational + query. + contexts (Sequence[~.context.Context]): + The collection of contexts to be activated + before this query is executed. + reset_contexts (bool): + Specifies whether to delete all contexts in + the current session before the new ones are + activated. + session_entity_types (Sequence[~.session_entity_type.SessionEntityType]): + Additional session entity types to replace or + extend developer entity types with. The entity + synonyms apply to all languages and persist for + the session of this query. + payload (~.struct.Struct): + This field can be used to pass custom data to your webhook. + Arbitrary JSON objects are supported. If supplied, the value + is used to populate the + ``WebhookRequest.original_detect_intent_request.payload`` + field sent to your webhook. + knowledge_base_names (Sequence[str]): + KnowledgeBases to get alternative results from. If not set, + the KnowledgeBases enabled in the agent (through UI) will be + used. Format: + ``projects//knowledgeBases/``. + sentiment_analysis_request_config (~.gcd_session.SentimentAnalysisRequestConfig): + Configures the type of sentiment analysis to + perform. If not provided, sentiment analysis is + not performed. Note: Sentiment Analysis is only + currently available for Essentials Edition + agents. + sub_agents (Sequence[~.agent.SubAgent]): + For mega agent query, directly specify which + sub agents to query. If any specified sub agent + is not linked to the mega agent, an error will + be returned. If empty, Dialogflow will decide + which sub agents to query. If specified for a + non-mega-agent query, will be silently ignored. + webhook_headers (Sequence[~.gcd_session.QueryParameters.WebhookHeadersEntry]): + 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 + configured through Dialogflow web console. The + headers defined within this field will overwrite + the headers configured through Dialogflow + console if there is a conflict. Header names are + case-insensitive. Google's specified headers are + not allowed. Including: "Host", "Content- + Length", "Connection", "From", "User-Agent", + "Accept-Encoding", "If-Modified-Since", "If- + None-Match", "X-Forwarded-For", etc. + """ + + time_zone = proto.Field(proto.STRING, number=1) + + geo_location = proto.Field(proto.MESSAGE, number=2, message=latlng.LatLng,) + + contexts = proto.RepeatedField(proto.MESSAGE, number=3, message=context.Context,) + + reset_contexts = proto.Field(proto.BOOL, number=4) + + session_entity_types = proto.RepeatedField( + proto.MESSAGE, number=5, message=session_entity_type.SessionEntityType, + ) + + payload = proto.Field(proto.MESSAGE, number=6, message=struct.Struct,) + + knowledge_base_names = proto.RepeatedField(proto.STRING, number=12) + + sentiment_analysis_request_config = proto.Field( + proto.MESSAGE, number=10, message="SentimentAnalysisRequestConfig", + ) + + sub_agents = proto.RepeatedField(proto.MESSAGE, number=13, message=agent.SubAgent,) + + webhook_headers = proto.MapField(proto.STRING, proto.STRING, number=14) + + +class QueryInput(proto.Message): + r"""Represents the query input. It can contain either: + 1. An audio config which + instructs the speech recognizer how to process the speech + audio. + 2. A conversational query in the form of text. + + 3. An event that specifies which intent to trigger. + + Attributes: + audio_config (~.gcd_audio_config.InputAudioConfig): + Instructs the speech recognizer how to + process the speech audio. + text (~.gcd_session.TextInput): + The natural language text to be processed. + event (~.gcd_session.EventInput): + The event to be processed. + """ + + audio_config = proto.Field( + proto.MESSAGE, + number=1, + oneof="input", + message=gcd_audio_config.InputAudioConfig, + ) + + text = proto.Field(proto.MESSAGE, number=2, oneof="input", message="TextInput",) + + event = proto.Field(proto.MESSAGE, number=3, oneof="input", message="EventInput",) + + +class QueryResult(proto.Message): + r"""Represents the result of conversational query or event + processing. + + Attributes: + query_text (str): + The original conversational query text: + + - If natural language text was provided as input, + ``query_text`` contains a copy of the input. + - If natural language speech audio was provided as input, + ``query_text`` contains the speech recognition result. If + speech recognizer produced multiple alternatives, a + particular one is picked. + - If automatic spell correction is enabled, ``query_text`` + will contain the corrected user input. + language_code (str): + The language that was triggered during intent detection. See + `Language + Support `__ + for a list of the currently supported language codes. + speech_recognition_confidence (float): + The Speech recognition confidence between 0.0 + and 1.0. A higher number indicates an estimated + greater likelihood that the recognized words are + correct. The default of 0.0 is a sentinel value + indicating that confidence was not set. + + This field is not guaranteed to be accurate or + set. In particular this field isn't set for + StreamingDetectIntent since the streaming + endpoint has separate confidence estimates per + portion of the audio in + StreamingRecognitionResult. + action (str): + The action name from the matched intent. + parameters (~.struct.Struct): + The collection of extracted parameters. + 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: string or + number, depending on parameter value type - + MapValue value: + - If parameter's entity type is a + composite entity: map from composite + entity property names to property values - + Else: parameter value + all_required_params_present (bool): + This field is set to: + + - ``false`` if the matched intent has required parameters + and not all of the required parameter values have been + collected. + - ``true`` if all required parameter values have been + collected, or if the matched intent doesn't contain any + required parameters. + fulfillment_text (str): + The text to be pronounced to the user or shown on the + screen. Note: This is a legacy field, + ``fulfillment_messages`` should be preferred. + fulfillment_messages (Sequence[~.gcd_intent.Intent.Message]): + The collection of rich messages to present to + the user. + webhook_source (str): + If the query was fulfilled by a webhook call, this field is + set to the value of the ``source`` field returned in the + webhook response. + webhook_payload (~.struct.Struct): + If the query was fulfilled by a webhook call, this field is + set to the value of the ``payload`` field returned in the + webhook response. + output_contexts (Sequence[~.context.Context]): + The collection of output contexts. If applicable, + ``output_contexts.parameters`` contains entries with name + ``.original`` containing the original + parameter values before the query. + intent (~.gcd_intent.Intent): + The intent that matched the conversational query. Some, not + all fields are filled in this message, including but not + limited to: ``name``, ``display_name``, ``end_interaction`` + and ``is_fallback``. + intent_detection_confidence (float): + The intent detection confidence. Values range from 0.0 + (completely uncertain) to 1.0 (completely certain). This + value is for informational purpose only and is only used to + help match the best intent within the classification + threshold. This value may change for the same end-user + expression at any time due to a model retraining or change + in implementation. If there are + ``multiple knowledge_answers`` messages, this value is set + to the greatest ``knowledgeAnswers.match_confidence`` value + in the list. + diagnostic_info (~.struct.Struct): + Free-form diagnostic information for the + associated detect intent request. The fields of + this data can change without notice, so you + should not write code that depends on its + structure. + The data may contain: + + - webhook call latency + - webhook errors + sentiment_analysis_result (~.gcd_session.SentimentAnalysisResult): + The sentiment analysis result, which depends on the + ``sentiment_analysis_request_config`` specified in the + request. + knowledge_answers (~.gcd_session.KnowledgeAnswers): + The result from Knowledge Connector (if any), ordered by + decreasing ``KnowledgeAnswers.match_confidence``. + """ + + query_text = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=15) + + speech_recognition_confidence = proto.Field(proto.FLOAT, number=2) + + action = proto.Field(proto.STRING, number=3) + + parameters = proto.Field(proto.MESSAGE, number=4, message=struct.Struct,) + + all_required_params_present = proto.Field(proto.BOOL, number=5) + + fulfillment_text = proto.Field(proto.STRING, number=6) + + fulfillment_messages = proto.RepeatedField( + proto.MESSAGE, number=7, message=gcd_intent.Intent.Message, + ) + + webhook_source = proto.Field(proto.STRING, number=8) + + webhook_payload = proto.Field(proto.MESSAGE, number=9, message=struct.Struct,) + + output_contexts = proto.RepeatedField( + proto.MESSAGE, number=10, message=context.Context, + ) + + intent = proto.Field(proto.MESSAGE, number=11, message=gcd_intent.Intent,) + + intent_detection_confidence = proto.Field(proto.FLOAT, number=12) + + diagnostic_info = proto.Field(proto.MESSAGE, number=14, message=struct.Struct,) + + sentiment_analysis_result = proto.Field( + proto.MESSAGE, number=17, message="SentimentAnalysisResult", + ) + + knowledge_answers = proto.Field( + proto.MESSAGE, number=18, message="KnowledgeAnswers", + ) + + +class KnowledgeAnswers(proto.Message): + r"""Represents the result of querying a Knowledge base. + + Attributes: + answers (Sequence[~.gcd_session.KnowledgeAnswers.Answer]): + A list of answers from Knowledge Connector. + """ + + class Answer(proto.Message): + r"""An answer from Knowledge Connector. + + Attributes: + source (str): + Indicates which Knowledge Document this answer was extracted + from. Format: + ``projects//knowledgeBases//documents/``. + faq_question (str): + The corresponding FAQ question if the answer + was extracted from a FAQ Document, empty + otherwise. + answer (str): + The piece of text from the ``source`` knowledge base + document that answers this conversational query. + match_confidence_level (~.gcd_session.KnowledgeAnswers.Answer.MatchConfidenceLevel): + The system's confidence level that this knowledge answer is + a good match for this conversational query. NOTE: The + confidence level for a given ```` pair may + change without notice, as it depends on models that are + constantly being improved. However, it will change less + frequently than the confidence score below, and should be + preferred for referencing the quality of an answer. + match_confidence (float): + The system's confidence score that this Knowledge answer is + a good match for this conversational query. The range is + from 0.0 (completely uncertain) to 1.0 (completely certain). + Note: The confidence score is likely to vary somewhat + (possibly even for identical requests), as the underlying + model is under constant improvement. It may be deprecated in + the future. We recommend using ``match_confidence_level`` + which should be generally more stable. + """ + + class MatchConfidenceLevel(proto.Enum): + r"""Represents the system's confidence that this knowledge answer + is a good match for this conversational query. + """ + MATCH_CONFIDENCE_LEVEL_UNSPECIFIED = 0 + LOW = 1 + MEDIUM = 2 + HIGH = 3 + + source = proto.Field(proto.STRING, number=1) + + faq_question = proto.Field(proto.STRING, number=2) + + answer = proto.Field(proto.STRING, number=3) + + match_confidence_level = proto.Field( + proto.ENUM, number=4, enum="KnowledgeAnswers.Answer.MatchConfidenceLevel", + ) + + match_confidence = proto.Field(proto.FLOAT, number=5) + + answers = proto.RepeatedField(proto.MESSAGE, number=1, message=Answer,) + + +class StreamingDetectIntentRequest(proto.Message): + r"""The top-level message sent by the client to the + [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent] + method. + + Multiple request messages should be sent in order: + + 1. The first message must contain + [session][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.session], + [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] + plus optionally + [query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. + If the client wants to receive an audio response, it should also + contain + [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config]. + The message must not contain + [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio]. + + 2. If + [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] + was set to + [query_input.audio_config][google.cloud.dialogflow.v2beta1.InputAudioConfig], + all subsequent messages must contain + [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio] + to continue with Speech recognition. If you decide to rather + detect an intent from text input after you already started Speech + recognition, please send a message with + [query_input.text][google.cloud.dialogflow.v2beta1.QueryInput.text]. + + However, note that: + + - Dialogflow will bill you for the audio duration so far. + - Dialogflow discards all Speech recognition results in favor of + the input text. + - Dialogflow will use the language code from the first message. + + After you sent all input, you must half-close or abort the request + stream. + + Attributes: + session (str): + Required. The name of the session the query is sent to. + Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we are using "-". It's up to the API caller to + choose an appropriate ``Session ID`` and ``User Id``. They + can be a random number or some type of user and session + identifiers (preferably hashed). The length of the + ``Session ID`` and ``User ID`` must not exceed 36 + characters. + + For more information, see the `API interactions + guide `__. + + Note: Always use agent versions for production traffic. See + `Versions and + environments `__. + query_params (~.gcd_session.QueryParameters): + The parameters of this query. + query_input (~.gcd_session.QueryInput): + Required. The input specification. It can be + set to: + 1. an audio config which instructs the speech + recognizer how to process the speech audio, + + 2. a conversational query in the form of text, + or + 3. an event that specifies which intent to + trigger. + single_utterance (bool): + DEPRECATED. Please use + [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2beta1.InputAudioConfig.single_utterance] + instead. If ``false`` (default), recognition does not cease + until the client closes the stream. If ``true``, the + recognizer will detect a single spoken utterance in input + audio. Recognition ceases when it detects the audio's voice + has stopped or paused. In this case, once a detected intent + is received, the client should close the stream and start a + new request with a new stream as needed. This setting is + ignored when ``query_input`` is a piece of text or an event. + output_audio_config (~.gcd_audio_config.OutputAudioConfig): + Instructs the speech synthesizer how to + generate the output audio. If this field is not + set and agent-level speech synthesizer is not + configured, no output audio is generated. + output_audio_config_mask (~.field_mask.FieldMask): + Mask for + [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] + indicating which settings in this request-level config + should override speech synthesizer settings defined at + agent-level. + + If unspecified or empty, + [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] + replaces the agent-level config in its entirety. + input_audio (bytes): + The input audio content to be recognized. Must be sent if + ``query_input`` was set to a streaming input audio config. + The complete audio over all streaming messages must not + exceed 1 minute. + """ + + 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",) + + single_utterance = proto.Field(proto.BOOL, number=4) + + output_audio_config = proto.Field( + proto.MESSAGE, number=5, message=gcd_audio_config.OutputAudioConfig, + ) + + output_audio_config_mask = proto.Field( + proto.MESSAGE, number=7, message=field_mask.FieldMask, + ) + + input_audio = proto.Field(proto.BYTES, number=6) + + +class StreamingDetectIntentResponse(proto.Message): + r"""The top-level message returned from the ``StreamingDetectIntent`` + method. + + Multiple response messages can be returned in order: + + 1. If the input was set to streaming audio, the first one or more + messages contain ``recognition_result``. Each + ``recognition_result`` represents a more complete transcript of + what the user said. The last ``recognition_result`` has + ``is_final`` set to ``true``. + + 2. The next message contains ``response_id``, ``query_result``, + ``alternative_query_results`` and optionally ``webhook_status`` + if a WebHook was called. + + 3. If ``output_audio_config`` was specified in the request or + agent-level speech synthesizer is configured, all subsequent + messages contain ``output_audio`` and ``output_audio_config``. + + Attributes: + response_id (str): + The unique identifier of the response. It can + be used to locate a response in the training + example set or for reporting issues. + recognition_result (~.gcd_session.StreamingRecognitionResult): + The result of speech recognition. + query_result (~.gcd_session.QueryResult): + The selected results of the conversational query or event + processing. See ``alternative_query_results`` for additional + potential results. + alternative_query_results (Sequence[~.gcd_session.QueryResult]): + If Knowledge Connectors are enabled, there could be more + than one result returned for a given query or event, and + this field will contain all results except for the top one, + which is captured in query_result. The alternative results + are ordered by decreasing + ``QueryResult.intent_detection_confidence``. If Knowledge + Connectors are disabled, this field will be empty until + multiple responses for regular intents are supported, at + which point those additional results will be surfaced here. + webhook_status (~.status.Status): + Specifies the status of the webhook request. + output_audio (bytes): + The audio data bytes encoded as specified in the request. + Note: The output audio is generated based on the values of + default platform text responses found in the + ``query_result.fulfillment_messages`` field. If multiple + default text responses exist, they will be concatenated when + generating audio. If no default platform text responses + exist, the generated audio content will be empty. + + In some scenarios, multiple output audio fields may be + present in the response structure. In these cases, only the + top-most-level audio output has content. + output_audio_config (~.gcd_audio_config.OutputAudioConfig): + The config used by the speech synthesizer to + generate the output audio. + """ + + response_id = proto.Field(proto.STRING, number=1) + + recognition_result = proto.Field( + proto.MESSAGE, number=2, message="StreamingRecognitionResult", + ) + + query_result = proto.Field(proto.MESSAGE, number=3, message="QueryResult",) + + alternative_query_results = proto.RepeatedField( + proto.MESSAGE, number=7, message="QueryResult", + ) + + webhook_status = proto.Field(proto.MESSAGE, number=4, message=status.Status,) + + output_audio = proto.Field(proto.BYTES, number=5) + + output_audio_config = proto.Field( + proto.MESSAGE, number=6, message=gcd_audio_config.OutputAudioConfig, + ) + + +class StreamingRecognitionResult(proto.Message): + r"""Contains a speech recognition result corresponding to a portion of + the audio that is currently being processed or an indication that + this is the end of the single requested utterance. + + Example: + + 1. transcript: "tube" + + 2. transcript: "to be a" + + 3. transcript: "to be" + + 4. transcript: "to be or not to be" is_final: true + + 5. transcript: " that's" + + 6. transcript: " that is" + + 7. message_type: ``END_OF_SINGLE_UTTERANCE`` + + 8. transcript: " that is the question" is_final: true + + Only two of the responses contain final results (#4 and #8 indicated + by ``is_final: true``). Concatenating these generates the full + transcript: "to be or not to be that is the question". + + In each response we populate: + + - for ``TRANSCRIPT``: ``transcript`` and possibly ``is_final``. + + - for ``END_OF_SINGLE_UTTERANCE``: only ``message_type``. + + Attributes: + message_type (~.gcd_session.StreamingRecognitionResult.MessageType): + Type of the result message. + transcript (str): + Transcript text representing the words that the user spoke. + Populated if and only if ``message_type`` = ``TRANSCRIPT``. + is_final (bool): + If ``false``, the ``StreamingRecognitionResult`` represents + an interim result that may change. If ``true``, the + recognizer will not return any further hypotheses about this + piece of the audio. May only be populated for + ``message_type`` = ``TRANSCRIPT``. + confidence (float): + The Speech confidence between 0.0 and 1.0 for the current + portion of audio. A higher number indicates an estimated + greater likelihood that the recognized words are correct. + The default of 0.0 is a sentinel value indicating that + confidence was not set. + + This field is typically only provided if ``is_final`` is + true and you should not rely on it being accurate or even + set. + stability (float): + An estimate of the likelihood that the speech recognizer + will not change its guess about this interim recognition + result: + + - If the value is unspecified or 0.0, Dialogflow didn't + compute the stability. In particular, Dialogflow will + only provide stability for ``TRANSCRIPT`` results with + ``is_final = false``. + - Otherwise, the value is in (0.0, 1.0] where 0.0 means + completely unstable and 1.0 means completely stable. + speech_word_info (Sequence[~.gcd_audio_config.SpeechWordInfo]): + Word-specific information for the words recognized by Speech + in + [transcript][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.transcript]. + Populated if and only if ``message_type`` = ``TRANSCRIPT`` + and [InputAudioConfig.enable_word_info] is set. + speech_end_offset (~.duration.Duration): + Time offset of the end of this Speech recognition result + relative to the beginning of the audio. Only populated for + ``message_type`` = ``TRANSCRIPT``. + dtmf_digits (~.gcd_audio_config.TelephonyDtmfEvents): + DTMF digits. Populated if and only if ``message_type`` = + ``DTMF_DIGITS``. + """ + + class MessageType(proto.Enum): + r"""Type of the response message.""" + MESSAGE_TYPE_UNSPECIFIED = 0 + 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) + + speech_word_info = proto.RepeatedField( + proto.MESSAGE, number=7, message=gcd_audio_config.SpeechWordInfo, + ) + + speech_end_offset = proto.Field(proto.MESSAGE, number=8, message=duration.Duration,) + + dtmf_digits = proto.Field( + proto.MESSAGE, number=5, message=gcd_audio_config.TelephonyDtmfEvents, + ) + + +class TextInput(proto.Message): + r"""Represents the natural language text to be processed. + + Attributes: + text (str): + Required. The UTF-8 encoded natural language + text to be processed. Text length must not + exceed 256 characters. + language_code (str): + Required. The language of this conversational query. See + `Language + Support `__ + for a list of the currently supported language codes. Note + that queries in the same session do not necessarily need to + specify the same language. + """ + + text = proto.Field(proto.STRING, number=1) + + language_code = proto.Field(proto.STRING, number=2) + + +class EventInput(proto.Message): + r"""Events allow for matching intents by event name instead of the + natural language input. For instance, input + ```` + can trigger a personalized welcome response. The parameter ``name`` + may be used by the agent in the response: + ``"Hello #welcome_event.name! What can I do for you today?"``. + + Attributes: + name (str): + Required. The unique identifier of the event. + parameters (~.struct.Struct): + The collection of parameters associated with + the event. + 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: string or + number, depending on parameter value type - + MapValue value: + - If parameter's entity type is a + composite entity: map from composite + entity property names to property values - + Else: parameter value + language_code (str): + Required. The language of this query. See `Language + Support `__ + for a list of the currently supported language codes. Note + that queries in the same session do not necessarily need to + specify the same language. + """ + + name = proto.Field(proto.STRING, number=1) + + parameters = proto.Field(proto.MESSAGE, number=2, message=struct.Struct,) + + language_code = proto.Field(proto.STRING, number=3) + + +class SentimentAnalysisRequestConfig(proto.Message): + r"""Configures the types of sentiment analysis to perform. + + Attributes: + analyze_query_text_sentiment (bool): + Instructs the service to perform sentiment analysis on + ``query_text``. If not provided, sentiment analysis is not + performed on ``query_text``. + """ + + analyze_query_text_sentiment = proto.Field(proto.BOOL, number=1) + + +class SentimentAnalysisResult(proto.Message): + r"""The result of sentiment analysis. Sentiment analysis inspects user + input and identifies the prevailing subjective opinion, especially + to determine a user's attitude as positive, negative, or neutral. + For [Participants.DetectIntent][], it needs to be configured in + [DetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.DetectIntentRequest.query_params]. + For [Participants.StreamingDetectIntent][], it needs to be + configured in + [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. + And for + [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] + and + [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent], + it needs to be configured in + [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2beta1.ConversationProfile.human_agent_assistant_config] + + Attributes: + query_text_sentiment (~.gcd_session.Sentiment): + The sentiment analysis result for ``query_text``. + """ + + query_text_sentiment = proto.Field(proto.MESSAGE, number=1, message="Sentiment",) + + +class Sentiment(proto.Message): + r"""The sentiment, such as positive/negative feeling or + association, for a unit of analysis, such as the query text. + + Attributes: + score (float): + Sentiment score between -1.0 (negative + sentiment) and 1.0 (positive sentiment). + magnitude (float): + A non-negative number in the [0, +inf) range, which + represents the absolute magnitude of sentiment, regardless + of score (positive or negative). + """ + + score = proto.Field(proto.FLOAT, number=1) + + magnitude = proto.Field(proto.FLOAT, number=2) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/session_entity_type.py b/google/cloud/dialogflow_v2beta1/types/session_entity_type.py new file mode 100644 index 000000000..35f61c1ce --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/session_entity_type.py @@ -0,0 +1,245 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.cloud.dialogflow_v2beta1.types import entity_type +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={ + "SessionEntityType", + "ListSessionEntityTypesRequest", + "ListSessionEntityTypesResponse", + "GetSessionEntityTypeRequest", + "CreateSessionEntityTypeRequest", + "UpdateSessionEntityTypeRequest", + "DeleteSessionEntityTypeRequest", + }, +) + + +class SessionEntityType(proto.Message): + r"""A session represents a conversation between a Dialogflow agent and + an end-user. You can create special entities, called session + entities, during a session. Session entities can extend or replace + custom entity types and only exist during the session that they were + created for. All session data, including session entities, is stored + by Dialogflow for 20 minutes. + + For more information, see the `session entity + guide `__. + + Attributes: + name (str): + Required. The unique identifier of this session entity type. + Supported formats: + + - ``projects//agent/sessions//entityTypes/`` + - ``projects//locations//agent/sessions//entityTypes/`` + - ``projects//agent/environments//users//sessions//entityTypes/`` + - ``projects//locations//agent/environments/ /users//sessions//entityTypes/`` + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + ```` must be the display name of + an existing entity type in the same agent that will be + overridden or supplemented. + entity_override_mode (~.gcd_session_entity_type.SessionEntityType.EntityOverrideMode): + Required. Indicates whether the additional + data should override or supplement the custom + entity type definition. + entities (Sequence[~.entity_type.EntityType.Entity]): + Required. The collection of entities + associated with this session entity type. + """ + + class EntityOverrideMode(proto.Enum): + r"""The types of modifications for a session entity type.""" + ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0 + 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=2, enum=EntityOverrideMode,) + + entities = proto.RepeatedField( + proto.MESSAGE, number=3, message=entity_type.EntityType.Entity, + ) + + +class ListSessionEntityTypesRequest(proto.Message): + r"""The request message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. + + Attributes: + parent (str): + Required. The session to list all session entity types from. + Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + page_size (int): + Optional. The maximum number of items to + return in a single page. By default 100 and at + most 1000. + page_token (str): + Optional. The next_page_token value returned from a previous + list request. + """ + + 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): + r"""The response message for + [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. + + Attributes: + session_entity_types (Sequence[~.gcd_session_entity_type.SessionEntityType]): + The list of session entity types. There will be a maximum + number of items returned based on the page_size field in the + request. + next_page_token (str): + Token to retrieve the next page of results, + or empty if there are no more results in the + list. + """ + + @property + def raw_page(self): + return self + + session_entity_types = proto.RepeatedField( + proto.MESSAGE, number=1, message="SessionEntityType", + ) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class GetSessionEntityTypeRequest(proto.Message): + r"""The request message for + [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType]. + + Attributes: + name (str): + Required. The name of the session entity type. Supported + formats: + + - ``projects//agent/sessions//entityTypes/`` + - ``projects//locations//agent/sessions//entityTypes/`` + - ``projects//agent/environments//users//sessions//entityTypes/`` + - ``projects//locations//agent/environments/ /users//sessions//entityTypes/`` + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + """ + + name = proto.Field(proto.STRING, number=1) + + +class CreateSessionEntityTypeRequest(proto.Message): + r"""The request message for + [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType]. + + Attributes: + parent (str): + Required. The session to create a session entity type for. + Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + session_entity_type (~.gcd_session_entity_type.SessionEntityType): + Required. The session entity type to create. + """ + + parent = proto.Field(proto.STRING, number=1) + + session_entity_type = proto.Field( + proto.MESSAGE, number=2, message="SessionEntityType", + ) + + +class UpdateSessionEntityTypeRequest(proto.Message): + r"""The request message for + [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType]. + + Attributes: + session_entity_type (~.gcd_session_entity_type.SessionEntityType): + Required. The session entity type to update. + update_mask (~.field_mask.FieldMask): + Optional. The mask to control which fields + get updated. + """ + + session_entity_type = proto.Field( + proto.MESSAGE, number=1, message="SessionEntityType", + ) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteSessionEntityTypeRequest(proto.Message): + r"""The request message for + [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType]. + + Attributes: + name (str): + Required. The name of the entity type to delete. Supported + formats: + + - ``projects//agent/sessions//entityTypes/`` + - ``projects//locations//agent/sessions//entityTypes/`` + - ``projects//agent/environments//users//sessions//entityTypes/`` + - ``projects//locations//agent/environments/ /users//sessions//entityTypes/`` + + If ``Location ID`` is not specified we assume default 'us' + location. If ``Environment ID`` is not specified, we assume + default 'draft' environment. If ``User ID`` is not + specified, we assume default '-' user. + """ + + name = proto.Field(proto.STRING, number=1) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/validation_result.py b/google/cloud/dialogflow_v2beta1/types/validation_result.py new file mode 100644 index 000000000..097ca3d7e --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/validation_result.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={"ValidationError", "ValidationResult",}, +) + + +class ValidationError(proto.Message): + r"""Represents a single validation error. + + Attributes: + severity (~.validation_result.ValidationError.Severity): + The severity of the error. + entries (Sequence[str]): + The names of the entries that the error is + associated with. Format: + + - "projects//agent", if the error is + associated with the entire agent. + - "projects//agent/intents/", if the error is associated with certain + intents. + - "projects//agent/intents//trainingPhrases/", if + the error is associated with certain intent + training phrases. - "projects//agent/intents//parameters/", if the error is + associated with certain intent parameters. - + "projects//agent/entities/", if the error is associated with certain + entities. + error_message (str): + The detailed error messsage. + """ + + class Severity(proto.Enum): + r"""Represents a level of severity.""" + SEVERITY_UNSPECIFIED = 0 + INFO = 1 + WARNING = 2 + ERROR = 3 + CRITICAL = 4 + + severity = proto.Field(proto.ENUM, number=1, enum=Severity,) + + entries = proto.RepeatedField(proto.STRING, number=3) + + error_message = proto.Field(proto.STRING, number=4) + + +class ValidationResult(proto.Message): + r"""Represents the output of agent validation. + + Attributes: + validation_errors (Sequence[~.validation_result.ValidationError]): + Contains all validation errors. + """ + + validation_errors = proto.RepeatedField( + proto.MESSAGE, number=1, message="ValidationError", + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflow_v2beta1/types/webhook.py b/google/cloud/dialogflow_v2beta1/types/webhook.py new file mode 100644 index 000000000..8bd55e799 --- /dev/null +++ b/google/cloud/dialogflow_v2beta1/types/webhook.py @@ -0,0 +1,221 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import proto # type: ignore + + +from google.cloud.dialogflow_v2beta1.types import context +from google.cloud.dialogflow_v2beta1.types import intent +from google.cloud.dialogflow_v2beta1.types import session as gcd_session +from google.cloud.dialogflow_v2beta1.types import session_entity_type +from google.protobuf import struct_pb2 as struct # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.v2beta1", + manifest={"WebhookRequest", "WebhookResponse", "OriginalDetectIntentRequest",}, +) + + +class WebhookRequest(proto.Message): + r"""The request message for a webhook call. + + Attributes: + session (str): + The unique identifier of detectIntent request session. Can + be used to identify end-user inside webhook implementation. + Supported formats: + + - \`projects//agent/sessions/, + - ``projects//locations//agent/sessions/``, + - ``projects//agent/environments//users//sessions/``, + - ``projects//locations//agent/environments//users//sessions/``, + response_id (str): + The unique identifier of the response. Contains the same + value as ``[Streaming]DetectIntentResponse.response_id``. + query_result (~.gcd_session.QueryResult): + The result of the conversational query or event processing. + Contains the same value as + ``[Streaming]DetectIntentResponse.query_result``. + alternative_query_results (Sequence[~.gcd_session.QueryResult]): + Alternative query results from + KnowledgeService. + original_detect_intent_request (~.webhook.OriginalDetectIntentRequest): + Optional. The contents of the original request that was + passed to ``[Streaming]DetectIntent`` call. + """ + + session = proto.Field(proto.STRING, number=4) + + response_id = proto.Field(proto.STRING, number=1) + + query_result = proto.Field( + proto.MESSAGE, number=2, message=gcd_session.QueryResult, + ) + + alternative_query_results = proto.RepeatedField( + proto.MESSAGE, number=5, message=gcd_session.QueryResult, + ) + + original_detect_intent_request = proto.Field( + proto.MESSAGE, number=3, message="OriginalDetectIntentRequest", + ) + + +class WebhookResponse(proto.Message): + r"""The response message for a webhook call. + + This response is validated by the Dialogflow server. If validation + fails, an error will be returned in the + [QueryResult.diagnostic_info][google.cloud.dialogflow.v2beta1.QueryResult.diagnostic_info] + field. Setting JSON fields to an empty value with the wrong type is + a common error. To avoid this error: + + - Use ``""`` for empty strings + - Use ``{}`` or ``null`` for empty objects + - Use ``[]`` or ``null`` for empty arrays + + For more information, see the `Protocol Buffers Language + Guide `__. + + Attributes: + fulfillment_text (str): + Optional. The text response message intended for the + end-user. It is recommended to use + ``fulfillment_messages.text.text[0]`` instead. When + provided, Dialogflow uses this field to populate + [QueryResult.fulfillment_text][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_text] + sent to the integration or API caller. + fulfillment_messages (Sequence[~.intent.Intent.Message]): + Optional. The rich response messages intended for the + end-user. When provided, Dialogflow uses this field to + populate + [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_messages] + sent to the integration or API caller. + source (str): + Optional. A custom field used to identify the webhook + source. Arbitrary strings are supported. When provided, + Dialogflow uses this field to populate + [QueryResult.webhook_source][google.cloud.dialogflow.v2beta1.QueryResult.webhook_source] + sent to the integration or API caller. + payload (~.struct.Struct): + Optional. This field can be used to pass custom data from + your webhook to the integration or API caller. Arbitrary + JSON objects are supported. When provided, Dialogflow uses + this field to populate + [QueryResult.webhook_payload][google.cloud.dialogflow.v2beta1.QueryResult.webhook_payload] + sent to the integration or API caller. This field is also + used by the `Google Assistant + integration `__ + for rich response messages. See the format definition at + `Google Assistant Dialogflow webhook + format `__ + output_contexts (Sequence[~.context.Context]): + Optional. The collection of output contexts that will + overwrite currently active contexts for the session and + reset their lifespans. When provided, Dialogflow uses this + field to populate + [QueryResult.output_contexts][google.cloud.dialogflow.v2beta1.QueryResult.output_contexts] + sent to the integration or API caller. + followup_event_input (~.gcd_session.EventInput): + Optional. Invokes the supplied events. When this field is + set, Dialogflow ignores the ``fulfillment_text``, + ``fulfillment_messages``, and ``payload`` fields. + end_interaction (bool): + Optional. Indicates that this intent ends an + interaction. Some integrations (e.g., Actions on + Google or Dialogflow phone gateway) use this + information to close interaction with an end + user. Default is false. + session_entity_types (Sequence[~.session_entity_type.SessionEntityType]): + Optional. Additional session entity types to replace or + extend developer entity types with. The entity synonyms + apply to all languages and persist for the session. Setting + this data from a webhook overwrites the session entity types + that have been set using ``detectIntent``, + ``streamingDetectIntent`` or + [SessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityType] + management methods. + """ + + fulfillment_text = proto.Field(proto.STRING, number=1) + + fulfillment_messages = proto.RepeatedField( + proto.MESSAGE, number=2, message=intent.Intent.Message, + ) + + source = proto.Field(proto.STRING, number=3) + + payload = proto.Field(proto.MESSAGE, number=4, message=struct.Struct,) + + output_contexts = proto.RepeatedField( + proto.MESSAGE, number=5, message=context.Context, + ) + + followup_event_input = proto.Field( + proto.MESSAGE, number=6, message=gcd_session.EventInput, + ) + + end_interaction = proto.Field(proto.BOOL, number=8) + + session_entity_types = proto.RepeatedField( + proto.MESSAGE, number=10, message=session_entity_type.SessionEntityType, + ) + + +class OriginalDetectIntentRequest(proto.Message): + r"""Represents the contents of the original request that was passed to + the ``[Streaming]DetectIntent`` call. + + Attributes: + source (str): + The source of this request, e.g., ``google``, ``facebook``, + ``slack``. It is set by Dialogflow-owned servers. + version (str): + Optional. The version of the protocol used + for this request. This field is AoG-specific. + payload (~.struct.Struct): + Optional. This field is set to the value of the + ``QueryParameters.payload`` field passed in the request. + Some integrations that query a Dialogflow agent may provide + additional information in the payload. + + In particular, for the Dialogflow Phone Gateway integration, + this field has the form: + + .. raw:: html + +
{
+                 "telephony": {
+                   "caller_id": "+18558363987"
+                 }
+                }
+ + Note: The caller ID field (``caller_id``) will be redacted + for Trial Edition agents and populated with the caller ID in + `E.164 format `__ for + Essentials Edition agents. + """ + + source = proto.Field(proto.STRING, number=1) + + version = proto.Field(proto.STRING, number=2) + + payload = proto.Field(proto.MESSAGE, number=3, message=struct.Struct,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 000000000..4505b4854 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.6 +namespace_packages = True diff --git a/noxfile.py b/noxfile.py index 1216e11af..b682def01 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,10 +1,12 @@ -# Copyright 2017, Google LLC +# -*- coding: utf-8 -*- +# +# Copyright 2018 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 +# https://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, @@ -12,48 +14,54 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Generated by synthtool. DO NOT EDIT! + from __future__ import absolute_import import os import shutil import nox -BLACK_VERSION = "black==19.3b0" -BLACK_PATHS = [ - "dialogflow", - "dialogflow_v2", - "dialogflow_v2beta1", - "tests", - "docs", - "noxfile.py", - "setup.py", -] +BLACK_VERSION = "black==19.10b0" +BLACK_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"] -@nox.session(python="3.7") + +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): """Run linters. + Returns a failure if the linters find linting errors or sufficiently serious code quality issues. """ session.install("flake8", BLACK_VERSION) - session.run("black", "--check", *BLACK_PATHS) - session.run("flake8", "dialogflow", "dialogflow_v2", "dialogflow_v2beta1") + session.run( + "black", "--check", *BLACK_PATHS, + ) + session.run("flake8", "google", "tests") @nox.session(python="3.6") def blacken(session): """Run black. + Format code to uniform standard. + This currently uses Python 3.6 due to the automated Kokoro run of synthtool. That run uses an image that doesn't have 3.6 installed. Before updating this check the state of the `gcp_ubuntu_config` we use for that Kokoro run. """ session.install(BLACK_VERSION) - session.run("black", *BLACK_PATHS) + session.run( + "black", *BLACK_PATHS, + ) -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" session.install("docutils", "pygments") @@ -62,16 +70,20 @@ def lint_setup_py(session): def default(session): # Install all test dependencies, then install this package in-place. - session.install("mock", "pytest", "pytest-cov") + session.install("asyncmock", "pytest-asyncio") + + session.install( + "mock", "pytest", "pytest-cov", + ) session.install("-e", ".") # Run py.test against the unit tests. session.run( "py.test", "--quiet", - "--cov=dialogflow", - "--cov=dialogflow_v2beta1", - "--cov=dialogflow_v2" "--cov-append", + "--cov=google/cloud", + "--cov=tests/unit", + "--cov-append", "--cov-config=.coveragerc", "--cov-report=", "--cov-fail-under=0", @@ -80,36 +92,108 @@ def default(session): ) -@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"]) +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS) def unit(session): """Run the unit test suite.""" default(session) -@nox.session(python="3.7") +@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) +def system(session): + """Run the system test suite.""" + system_test_path = os.path.join("tests", "system.py") + system_test_folder_path = os.path.join("tests", "system") + + # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true. + if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false": + session.skip("RUN_SYSTEM_TESTS is set to false, skipping") + # Sanity check: Only run tests if the environment variable is set. + if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): + session.skip("Credentials must be set via environment variable") + + system_test_exists = os.path.exists(system_test_path) + system_test_folder_exists = os.path.exists(system_test_folder_path) + # Sanity check: only run tests if found. + 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", + ) + session.install("-e", ".") + + # Run py.test against the system tests. + if system_test_exists: + session.run("py.test", "--quiet", system_test_path, *session.posargs) + if system_test_folder_exists: + session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) def cover(session): """Run the final coverage report. + This outputs the coverage report aggregating coverage from the unit test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=96") + session.run("coverage", "report", "--show-missing", "--fail-under=100") session.run("coverage", "erase") -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def docs(session): """Build the docs for this library.""" session.install("-e", ".") - session.install("sphinx<3.0.0", "alabaster", "recommonmark") + session.install("sphinx", "alabaster", "recommonmark") + + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) + session.run( + "sphinx-build", + "-T", # show full traceback on exception + "-N", # no colors + "-b", + "html", + "-d", + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def docfx(session): + """Build the docfx yaml files for this library.""" + + session.install("-e", ".") + # sphinx-docfx-yaml supports up to sphinx version 1.5.5. + # https://github.com/docascode/sphinx-docfx-yaml/issues/97 + session.install("sphinx==1.5.5", "alabaster", "recommonmark", "sphinx-docfx-yaml") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( "sphinx-build", "-T", # show full traceback on exception "-N", # no colors + "-D", + ( + "extensions=sphinx.ext.autodoc," + "sphinx.ext.autosummary," + "docfx_yaml.extension," + "sphinx.ext.intersphinx," + "sphinx.ext.coverage," + "sphinx.ext.napoleon," + "sphinx.ext.todo," + "sphinx.ext.viewcode," + "recommonmark" + ), "-b", "html", "-d", diff --git a/samples/snippets/create_document_test.py b/samples/snippets/create_document_test.py index 441996ba9..7099eed41 100644 --- a/samples/snippets/create_document_test.py +++ b/samples/snippets/create_document_test.py @@ -17,7 +17,7 @@ import os import uuid -import dialogflow_v2beta1 as dialogflow +from google.cloud import dialogflow_v2beta1 import pytest import document_management @@ -31,11 +31,11 @@ @pytest.fixture(scope="function", autouse=True) def setup_teardown(): # Create a knowledge base to use in document management - client = dialogflow.KnowledgeBasesClient() - project_path = client.project_path(PROJECT_ID) - knowledge_base = dialogflow.types.KnowledgeBase( + client = dialogflow_v2beta1.KnowledgeBasesClient() + project_path = client.common_project_path(PROJECT_ID) + knowledge_base = dialogflow_v2beta1.KnowledgeBase( display_name=KNOWLEDGE_BASE_NAME) - response = client.create_knowledge_base(project_path, knowledge_base) + response = client.create_knowledge_base(parent=project_path, knowledge_base=knowledge_base) pytest.KNOWLEDGE_BASE_ID = response.name.split( '/knowledgeBases/')[1].split('\n')[0] @@ -44,7 +44,10 @@ def setup_teardown(): # Delete the created knowledge base knowledge_base_path = client.knowledge_base_path( PROJECT_ID, pytest.KNOWLEDGE_BASE_ID) - client.delete_knowledge_base(knowledge_base_path, force=True) + request = dialogflow_v2beta1.DeleteKnowledgeBaseRequest( + name=knowledge_base_path, force=True + ) + client.delete_knowledge_base(request=request) @pytest.mark.flaky(max_runs=3, min_passes=1) diff --git a/samples/snippets/create_knowledge_base_test.py b/samples/snippets/create_knowledge_base_test.py index 2230099be..601a62047 100644 --- a/samples/snippets/create_knowledge_base_test.py +++ b/samples/snippets/create_knowledge_base_test.py @@ -17,7 +17,7 @@ import os import uuid -import dialogflow_v2beta1 as dialogflow +from google.cloud import dialogflow_v2beta1 import pytest import knowledge_base_management @@ -32,11 +32,11 @@ def teardown(): yield # Delete the created knowledge base - client = dialogflow.KnowledgeBasesClient() + client = dialogflow_v2beta1.KnowledgeBasesClient() assert pytest.KNOWLEDGE_BASE_ID is not None knowledge_base_path = client.knowledge_base_path( PROJECT_ID, pytest.KNOWLEDGE_BASE_ID) - client.delete_knowledge_base(knowledge_base_path) + client.delete_knowledge_base(name=knowledge_base_path) def test_create_knowledge_base(capsys): diff --git a/samples/snippets/detect_intent_audio.py b/samples/snippets/detect_intent_audio.py index 70fc370ed..0e1794334 100644 --- a/samples/snippets/detect_intent_audio.py +++ b/samples/snippets/detect_intent_audio.py @@ -37,12 +37,12 @@ def detect_intent_audio(project_id, session_id, audio_file_path, Using the same `session_id` between requests allows continuation of the conversation.""" - import dialogflow_v2 as dialogflow + from google.cloud import dialogflow session_client = dialogflow.SessionsClient() # Note: hard coding audio_encoding and sample_rate_hertz for simplicity. - audio_encoding = dialogflow.enums.AudioEncoding.AUDIO_ENCODING_LINEAR_16 + audio_encoding = dialogflow.AudioEncoding.AUDIO_ENCODING_LINEAR_16 sample_rate_hertz = 16000 session = session_client.session_path(project_id, session_id) @@ -51,14 +51,17 @@ def detect_intent_audio(project_id, session_id, audio_file_path, with open(audio_file_path, 'rb') as audio_file: input_audio = audio_file.read() - audio_config = dialogflow.types.InputAudioConfig( + audio_config = dialogflow.InputAudioConfig( audio_encoding=audio_encoding, language_code=language_code, sample_rate_hertz=sample_rate_hertz) - query_input = dialogflow.types.QueryInput(audio_config=audio_config) - - response = session_client.detect_intent( - session=session, query_input=query_input, - input_audio=input_audio) + query_input = dialogflow.QueryInput(audio_config=audio_config) + + request = dialogflow.DetectIntentRequest( + session=session, + query_input=query_input, + input_audio=input_audio, + ) + response = session_client.detect_intent(request=request) print('=' * 20) print('Query text: {}'.format(response.query_result.query_text)) diff --git a/samples/snippets/detect_intent_knowledge.py b/samples/snippets/detect_intent_knowledge.py index edfd4b517..56b9a1e00 100644 --- a/samples/snippets/detect_intent_knowledge.py +++ b/samples/snippets/detect_intent_knowledge.py @@ -40,28 +40,30 @@ def detect_intent_knowledge(project_id, session_id, language_code, knowledge_base_id: The Knowledge base's id to query against. texts: A list of text queries to send. """ - import dialogflow_v2beta1 as dialogflow + from google.cloud import dialogflow_v2beta1 as dialogflow session_client = dialogflow.SessionsClient() session_path = session_client.session_path(project_id, session_id) print('Session path: {}\n'.format(session_path)) for text in texts: - text_input = dialogflow.types.TextInput( + text_input = dialogflow.TextInput( text=text, language_code=language_code) - query_input = dialogflow.types.QueryInput(text=text_input) + query_input = dialogflow.QueryInput(text=text_input) - knowledge_base_path = dialogflow.knowledge_bases_client \ - .KnowledgeBasesClient \ + knowledge_base_path = dialogflow.KnowledgeBasesClient \ .knowledge_base_path(project_id, knowledge_base_id) - query_params = dialogflow.types.QueryParameters( + query_params = dialogflow.QueryParameters( knowledge_base_names=[knowledge_base_path]) - response = session_client.detect_intent( - session=session_path, query_input=query_input, - query_params=query_params) + request = dialogflow.DetectIntentRequest( + session=session_path, + query_input=query_input, + query_params=query_params + ) + response = session_client.detect_intent(request=request) print('=' * 20) print('Query text: {}'.format(response.query_result.query_text)) diff --git a/samples/snippets/detect_intent_stream.py b/samples/snippets/detect_intent_stream.py index 535358fd9..df3d33b11 100644 --- a/samples/snippets/detect_intent_stream.py +++ b/samples/snippets/detect_intent_stream.py @@ -36,21 +36,21 @@ def detect_intent_stream(project_id, session_id, audio_file_path, Using the same `session_id` between requests allows continuation of the conversation.""" - import dialogflow_v2 as dialogflow + from google.cloud import dialogflow session_client = dialogflow.SessionsClient() # Note: hard coding audio_encoding and sample_rate_hertz for simplicity. - audio_encoding = dialogflow.enums.AudioEncoding.AUDIO_ENCODING_LINEAR_16 + audio_encoding = dialogflow.AudioEncoding.AUDIO_ENCODING_LINEAR_16 sample_rate_hertz = 16000 session_path = session_client.session_path(project_id, session_id) print('Session path: {}\n'.format(session_path)) def request_generator(audio_config, audio_file_path): - query_input = dialogflow.types.QueryInput(audio_config=audio_config) + query_input = dialogflow.QueryInput(audio_config=audio_config) # The first request contains the configuration. - yield dialogflow.types.StreamingDetectIntentRequest( + yield dialogflow.StreamingDetectIntentRequest( session=session_path, query_input=query_input) # Here we are reading small chunks of audio data from a local @@ -62,15 +62,15 @@ def request_generator(audio_config, audio_file_path): if not chunk: break # The later requests contains audio data. - yield dialogflow.types.StreamingDetectIntentRequest( + yield dialogflow.StreamingDetectIntentRequest( input_audio=chunk) - audio_config = dialogflow.types.InputAudioConfig( + audio_config = dialogflow.InputAudioConfig( audio_encoding=audio_encoding, language_code=language_code, sample_rate_hertz=sample_rate_hertz) requests = request_generator(audio_config, audio_file_path) - responses = session_client.streaming_detect_intent(requests) + responses = session_client.streaming_detect_intent(requests=requests) print('=' * 20) for response in responses: diff --git a/samples/snippets/detect_intent_texts.py b/samples/snippets/detect_intent_texts.py index fba07904e..8630b519e 100644 --- a/samples/snippets/detect_intent_texts.py +++ b/samples/snippets/detect_intent_texts.py @@ -36,20 +36,20 @@ def detect_intent_texts(project_id, session_id, texts, language_code): Using the same `session_id` between requests allows continuation of the conversation.""" - import dialogflow_v2 as dialogflow + from google.cloud import dialogflow session_client = dialogflow.SessionsClient() session = session_client.session_path(project_id, session_id) print('Session path: {}\n'.format(session)) for text in texts: - text_input = dialogflow.types.TextInput( + text_input = dialogflow.TextInput( text=text, language_code=language_code) - query_input = dialogflow.types.QueryInput(text=text_input) + query_input = dialogflow.QueryInput(text=text_input) response = session_client.detect_intent( - session=session, query_input=query_input) + request={'session': session, 'query_input': query_input}) print('=' * 20) print('Query text: {}'.format(response.query_result.query_text)) diff --git a/samples/snippets/detect_intent_with_sentiment_analysis.py b/samples/snippets/detect_intent_with_sentiment_analysis.py index 852046073..c3a6e3121 100644 --- a/samples/snippets/detect_intent_with_sentiment_analysis.py +++ b/samples/snippets/detect_intent_with_sentiment_analysis.py @@ -35,29 +35,28 @@ def detect_intent_with_sentiment_analysis(project_id, session_id, texts, Using the same `session_id` between requests allows continuation of the conversation.""" - import dialogflow_v2 as dialogflow + from google.cloud import dialogflow session_client = dialogflow.SessionsClient() session_path = session_client.session_path(project_id, session_id) print('Session path: {}\n'.format(session_path)) for text in texts: - text_input = dialogflow.types.TextInput( + text_input = dialogflow.TextInput( text=text, language_code=language_code) - query_input = dialogflow.types.QueryInput(text=text_input) + query_input = dialogflow.QueryInput(text=text_input) # Enable sentiment analysis - sentiment_config = dialogflow.types.SentimentAnalysisRequestConfig( + sentiment_config = dialogflow.SentimentAnalysisRequestConfig( analyze_query_text_sentiment=True) # Set the query parameters with sentiment analysis - query_params = dialogflow.types.QueryParameters( + query_params = dialogflow.QueryParameters( sentiment_analysis_request_config=sentiment_config) response = session_client.detect_intent( - session=session_path, query_input=query_input, - query_params=query_params) + request={'session': session_path, 'query_input': query_input, 'query_params': query_params}) print('=' * 20) print('Query text: {}'.format(response.query_result.query_text)) diff --git a/samples/snippets/detect_intent_with_texttospeech_response.py b/samples/snippets/detect_intent_with_texttospeech_response.py index 5c0021241..630166d79 100644 --- a/samples/snippets/detect_intent_with_texttospeech_response.py +++ b/samples/snippets/detect_intent_with_texttospeech_response.py @@ -34,26 +34,29 @@ def detect_intent_with_texttospeech_response(project_id, session_id, texts, Using the same `session_id` between requests allows continuation of the conversation.""" - import dialogflow_v2 as dialogflow + from google.cloud import dialogflow session_client = dialogflow.SessionsClient() session_path = session_client.session_path(project_id, session_id) print('Session path: {}\n'.format(session_path)) for text in texts: - text_input = dialogflow.types.TextInput( + text_input = dialogflow.TextInput( text=text, language_code=language_code) - query_input = dialogflow.types.QueryInput(text=text_input) + query_input = dialogflow.QueryInput(text=text_input) # Set the query parameters with sentiment analysis - output_audio_config = dialogflow.types.OutputAudioConfig( - audio_encoding=dialogflow.enums.OutputAudioEncoding + output_audio_config = dialogflow.OutputAudioConfig( + audio_encoding=dialogflow.OutputAudioEncoding .OUTPUT_AUDIO_ENCODING_LINEAR_16) - response = session_client.detect_intent( - session=session_path, query_input=query_input, - output_audio_config=output_audio_config) + request = dialogflow.DetectIntentRequest( + session=session_path, + query_input=query_input, + output_audio_config=output_audio_config + ) + response = session_client.detect_intent(request=request) print('=' * 20) print('Query text: {}'.format(response.query_result.query_text)) diff --git a/samples/snippets/document_management.py b/samples/snippets/document_management.py index c7ed6f76f..2823bd495 100644 --- a/samples/snippets/document_management.py +++ b/samples/snippets/document_management.py @@ -46,19 +46,20 @@ def create_document(project_id, knowledge_base_id, display_name, mime_type, EXTRACTIVE_QA. content_uri: Uri of the document, e.g. gs://path/mydoc.csv, http://mypage.com/faq.html.""" - import dialogflow_v2beta1 as dialogflow + from google.cloud import dialogflow_v2beta1 as dialogflow client = dialogflow.DocumentsClient() - knowledge_base_path = client.knowledge_base_path(project_id, - knowledge_base_id) + knowledge_base_path = dialogflow.KnowledgeBasesClient.knowledge_base_path( + project_id, knowledge_base_id) - document = dialogflow.types.Document( + document = dialogflow.Document( display_name=display_name, mime_type=mime_type, content_uri=content_uri) document.knowledge_types.append( - dialogflow.types.Document.KnowledgeType.Value(knowledge_type)) + getattr(dialogflow.Document.KnowledgeType, knowledge_type) + ) - response = client.create_document(knowledge_base_path, document) + response = client.create_document(parent=knowledge_base_path, document=document) print('Waiting for results...') document = response.result(timeout=120) print('Created Document:') diff --git a/samples/snippets/intent_management.py b/samples/snippets/intent_management.py index 853e191c1..a1a4d0993 100644 --- a/samples/snippets/intent_management.py +++ b/samples/snippets/intent_management.py @@ -32,12 +32,12 @@ # [START dialogflow_list_intents] def list_intents(project_id): - import dialogflow_v2 as dialogflow + from google.cloud import dialogflow intents_client = dialogflow.IntentsClient() - parent = intents_client.project_agent_path(project_id) + parent = dialogflow.AgentsClient.agent_path(project_id) - intents = intents_client.list_intents(parent) + intents = intents_client.list_intents(request={'parent': parent}) for intent in intents: print('=' * 20) @@ -63,27 +63,27 @@ def list_intents(project_id): def create_intent(project_id, display_name, training_phrases_parts, message_texts): """Create an intent of the given intent type.""" - import dialogflow_v2 as dialogflow + from google.cloud import dialogflow intents_client = dialogflow.IntentsClient() - parent = intents_client.project_agent_path(project_id) + parent = dialogflow.AgentsClient.agent_path(project_id) training_phrases = [] for training_phrases_part in training_phrases_parts: - part = dialogflow.types.Intent.TrainingPhrase.Part( + part = dialogflow.Intent.TrainingPhrase.Part( text=training_phrases_part) # Here we create a new training phrase for each provided part. - training_phrase = dialogflow.types.Intent.TrainingPhrase(parts=[part]) + training_phrase = dialogflow.Intent.TrainingPhrase(parts=[part]) training_phrases.append(training_phrase) - text = dialogflow.types.Intent.Message.Text(text=message_texts) - message = dialogflow.types.Intent.Message(text=text) + text = dialogflow.Intent.Message.Text(text=message_texts) + message = dialogflow.Intent.Message(text=text) - intent = dialogflow.types.Intent( + intent = dialogflow.Intent( display_name=display_name, training_phrases=training_phrases, messages=[message]) - response = intents_client.create_intent(parent, intent) + response = intents_client.create_intent(request={'parent': parent, 'intent': intent}) print('Intent created: {}'.format(response)) # [END dialogflow_create_intent] @@ -92,22 +92,22 @@ def create_intent(project_id, display_name, training_phrases_parts, # [START dialogflow_delete_intent] def delete_intent(project_id, intent_id): """Delete intent with the given intent type and intent value.""" - import dialogflow_v2 as dialogflow + from google.cloud import dialogflow intents_client = dialogflow.IntentsClient() intent_path = intents_client.intent_path(project_id, intent_id) - intents_client.delete_intent(intent_path) + intents_client.delete_intent(request={'name': intent_path}) # [END dialogflow_delete_intent] # Helper to get intent from display name. def _get_intent_ids(project_id, display_name): - import dialogflow_v2 as dialogflow + from google.cloud import dialogflow intents_client = dialogflow.IntentsClient() - parent = intents_client.project_agent_path(project_id) - intents = intents_client.list_intents(parent) + parent = dialogflow.AgentsClient.agent_path(project_id) + intents = intents_client.list_intents(request={'parent': parent}) intent_names = [ intent.name for intent in intents if intent.display_name == display_name] diff --git a/samples/snippets/intent_management_test.py b/samples/snippets/intent_management_test.py index f1e5b3e8b..d47cebc44 100644 --- a/samples/snippets/intent_management_test.py +++ b/samples/snippets/intent_management_test.py @@ -33,8 +33,7 @@ def test_create_intent(capsys): intent_management.create_intent( - PROJECT_ID, INTENT_DISPLAY_NAME, TRAINING_PHRASE_PARTS, - MESSAGE_TEXTS) + PROJECT_ID, INTENT_DISPLAY_NAME, TRAINING_PHRASE_PARTS, MESSAGE_TEXTS) intent_ids = intent_management._get_intent_ids( PROJECT_ID, INTENT_DISPLAY_NAME) diff --git a/samples/snippets/knowledge_base_management.py b/samples/snippets/knowledge_base_management.py index 070f04d02..699217d94 100644 --- a/samples/snippets/knowledge_base_management.py +++ b/samples/snippets/knowledge_base_management.py @@ -32,14 +32,17 @@ def create_knowledge_base(project_id, display_name): Args: project_id: The GCP project linked with the agent. display_name: The display name of the Knowledge base.""" - import dialogflow_v2beta1 as dialogflow + from google.cloud import dialogflow_v2beta1 as dialogflow client = dialogflow.KnowledgeBasesClient() - project_path = client.project_path(project_id) + project_path = client.common_project_path(project_id) - knowledge_base = dialogflow.types.KnowledgeBase( + knowledge_base = dialogflow.KnowledgeBase( display_name=display_name) - response = client.create_knowledge_base(project_path, knowledge_base) + response = client.create_knowledge_base( + parent=project_path, + knowledge_base=knowledge_base + ) print('Knowledge Base created:\n') print('Display Name: {}\n'.format(response.display_name)) diff --git a/scripts/fixup_dialogflow_v2_keywords.py b/scripts/fixup_dialogflow_v2_keywords.py new file mode 100644 index 000000000..bb125c8fb --- /dev/null +++ b/scripts/fixup_dialogflow_v2_keywords.py @@ -0,0 +1,218 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class dialogflowCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'batch_create_entities': ('parent', 'entities', 'language_code', ), + 'batch_delete_entities': ('parent', 'entity_values', 'language_code', ), + 'batch_delete_entity_types': ('parent', 'entity_type_names', ), + 'batch_delete_intents': ('parent', 'intents', ), + 'batch_update_entities': ('parent', 'entities', 'language_code', 'update_mask', ), + 'batch_update_entity_types': ('parent', 'entity_type_batch_uri', 'entity_type_batch_inline', 'language_code', 'update_mask', ), + 'batch_update_intents': ('parent', 'intent_batch_uri', 'intent_batch_inline', 'language_code', 'update_mask', 'intent_view', ), + 'create_context': ('parent', 'context', ), + 'create_entity_type': ('parent', 'entity_type', 'language_code', ), + 'create_intent': ('parent', 'intent', 'language_code', 'intent_view', ), + 'create_session_entity_type': ('parent', 'session_entity_type', ), + 'delete_agent': ('parent', ), + 'delete_all_contexts': ('parent', ), + 'delete_context': ('name', ), + 'delete_entity_type': ('name', ), + 'delete_intent': ('name', ), + 'delete_session_entity_type': ('name', ), + 'detect_intent': ('session', 'query_input', 'query_params', 'output_audio_config', 'output_audio_config_mask', 'input_audio', ), + 'export_agent': ('parent', 'agent_uri', ), + 'get_agent': ('parent', ), + 'get_context': ('name', ), + 'get_entity_type': ('name', 'language_code', ), + 'get_intent': ('name', 'language_code', 'intent_view', ), + 'get_session_entity_type': ('name', ), + 'get_validation_result': ('parent', 'language_code', ), + 'import_agent': ('parent', 'agent_uri', 'agent_content', ), + 'list_contexts': ('parent', 'page_size', 'page_token', ), + 'list_entity_types': ('parent', 'language_code', 'page_size', 'page_token', ), + 'list_environments': ('parent', 'page_size', 'page_token', ), + 'list_intents': ('parent', 'language_code', 'intent_view', 'page_size', 'page_token', ), + 'list_session_entity_types': ('parent', 'page_size', 'page_token', ), + 'restore_agent': ('parent', 'agent_uri', 'agent_content', ), + 'search_agents': ('parent', 'page_size', 'page_token', ), + 'set_agent': ('agent', 'update_mask', ), + 'streaming_detect_intent': ('session', 'query_input', 'query_params', 'single_utterance', 'output_audio_config', 'output_audio_config_mask', 'input_audio', ), + 'train_agent': ('parent', ), + 'update_context': ('context', 'update_mask', ), + 'update_entity_type': ('entity_type', 'language_code', 'update_mask', ), + 'update_intent': ('intent', 'language_code', 'update_mask', 'intent_view', ), + 'update_session_entity_type': ('session_entity_type', 'update_mask', ), + + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: not a.keyword.value in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), + cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=dialogflowCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the dialogflow client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/scripts/fixup_dialogflow_v2beta1_keywords.py b/scripts/fixup_dialogflow_v2beta1_keywords.py new file mode 100644 index 000000000..00f5486b2 --- /dev/null +++ b/scripts/fixup_dialogflow_v2beta1_keywords.py @@ -0,0 +1,229 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2020 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. +# + +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class dialogflowCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'batch_create_entities': ('parent', 'entities', 'language_code', ), + 'batch_delete_entities': ('parent', 'entity_values', 'language_code', ), + 'batch_delete_entity_types': ('parent', 'entity_type_names', ), + 'batch_delete_intents': ('parent', 'intents', ), + 'batch_update_entities': ('parent', 'entities', 'language_code', 'update_mask', ), + 'batch_update_entity_types': ('parent', 'entity_type_batch_uri', 'entity_type_batch_inline', 'language_code', 'update_mask', ), + 'batch_update_intents': ('parent', 'intent_batch_uri', 'intent_batch_inline', 'language_code', 'update_mask', 'intent_view', ), + 'create_context': ('parent', 'context', ), + 'create_document': ('parent', 'document', 'import_gcs_custom_metadata', ), + 'create_entity_type': ('parent', 'entity_type', 'language_code', ), + 'create_intent': ('parent', 'intent', 'language_code', 'intent_view', ), + 'create_knowledge_base': ('parent', 'knowledge_base', ), + 'create_session_entity_type': ('parent', 'session_entity_type', ), + 'delete_agent': ('parent', ), + 'delete_all_contexts': ('parent', ), + 'delete_context': ('name', ), + 'delete_document': ('name', ), + 'delete_entity_type': ('name', ), + 'delete_intent': ('name', ), + 'delete_knowledge_base': ('name', 'force', ), + 'delete_session_entity_type': ('name', ), + 'detect_intent': ('session', 'query_input', 'query_params', 'output_audio_config', 'output_audio_config_mask', 'input_audio', ), + 'export_agent': ('parent', 'agent_uri', ), + 'get_agent': ('parent', ), + 'get_context': ('name', ), + 'get_document': ('name', ), + 'get_entity_type': ('name', 'language_code', ), + 'get_intent': ('name', 'language_code', 'intent_view', ), + 'get_knowledge_base': ('name', ), + 'get_session_entity_type': ('name', ), + 'get_validation_result': ('parent', 'language_code', ), + 'import_agent': ('parent', 'agent_uri', 'agent_content', ), + 'list_contexts': ('parent', 'page_size', 'page_token', ), + 'list_documents': ('parent', 'page_size', 'page_token', 'filter', ), + 'list_entity_types': ('parent', 'language_code', 'page_size', 'page_token', ), + 'list_environments': ('parent', 'page_size', 'page_token', ), + 'list_intents': ('parent', 'language_code', 'intent_view', 'page_size', 'page_token', ), + 'list_knowledge_bases': ('parent', 'page_size', 'page_token', 'filter', ), + 'list_session_entity_types': ('parent', 'page_size', 'page_token', ), + 'reload_document': ('name', 'gcs_source', 'import_gcs_custom_metadata', ), + 'restore_agent': ('parent', 'agent_uri', 'agent_content', ), + 'search_agents': ('parent', 'page_size', 'page_token', ), + 'set_agent': ('agent', 'update_mask', ), + 'streaming_detect_intent': ('session', 'query_input', 'query_params', 'single_utterance', 'output_audio_config', 'output_audio_config_mask', 'input_audio', ), + 'train_agent': ('parent', ), + 'update_context': ('context', 'update_mask', ), + 'update_document': ('document', 'update_mask', ), + 'update_entity_type': ('entity_type', 'language_code', 'update_mask', ), + 'update_intent': ('intent', 'language_code', 'update_mask', 'intent_view', ), + 'update_knowledge_base': ('knowledge_base', 'update_mask', ), + 'update_session_entity_type': ('session_entity_type', 'update_mask', ), + + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: not a.keyword.value in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), + cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=dialogflowCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the dialogflow client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/setup.py b/setup.py index b572825cc..b84416646 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ description = "Client library for the Dialogflow API" version = "1.1.0" release_status = "Development Status :: 5 - Production/Stable" -dependencies = ["google-api-core[grpc] >= 1.14.0, < 2.0.0dev"] +dependencies = ["google-api-core[grpc] >= 1.22.0, < 2.0.0dev", "proto-plus >= 1.10.0"] package_root = os.path.abspath(os.path.dirname(__file__)) @@ -29,10 +29,10 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -packages = setuptools.find_packages() +packages = setuptools.PEP420PackageFinder.find() setuptools.setup( - name="dialogflow", + name="google-cloud-dialogflow", description=description, long_description=readme, version=version, @@ -45,18 +45,21 @@ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", ], platforms="Posix; MacOS X; Windows", packages=packages, + extras={"libcst": "libcst >=0.2.5"}, + scripts=[ + "scripts/fixup_dialogflow_v2_keywords.py", + "scripts/fixup_dialogflow_v2beta1_keywords.py", + ], install_requires=dependencies, - python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", + python_requires=">=3.6", include_package_data=True, zip_safe=False, ) diff --git a/synth.metadata b/synth.metadata index 1040dae5a..c137e9282 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,21 +4,21 @@ "git": { "name": ".", "remote": "git@github.com:googleapis/dialogflow-python-client-v2.git", - "sha": "3d387173a0938ff1b5c82f99afcb02ab8b2afdc9" + "sha": "6994539cf55851c6bf96772b4ee0bdba05c073e2" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "c2de32114ec484aa708d32012d1fa8d75232daf5" + "sha": "352f25621c28d2fa0784984ea0ed5ea697aa1525" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "c2de32114ec484aa708d32012d1fa8d75232daf5" + "sha": "352f25621c28d2fa0784984ea0ed5ea697aa1525" } } ] diff --git a/synth.py b/synth.py index 71a556f60..fc33b8192 100644 --- a/synth.py +++ b/synth.py @@ -23,7 +23,6 @@ versions = ["v2beta1", "v2"] - for version in versions: library = gapic.py_library( "dialogflow", @@ -32,299 +31,23 @@ include_protos=True, ) - s.move( - library, - excludes=[ - "google/**/*", - "setup.py", - "README.rst", - "docs/index.rst", - "docs/conf.py", - "noxfile.py", - ], - ) - s.move(library / f"google/cloud/dialogflow_{version}", f"dialogflow_{version}") - - # Due to dialogflow being unique to the other google-cloud-* libraries, - # a decent number of edits need to be done to correct naming and namespaces - docs_paths = ["docs/**/*.rst", "docs/conf.py"] - s.replace(docs_paths, "google-cloud-dialogflow", "dialogflow") - s.replace(docs_paths, "google.cloud.dialogflow", "dialogflow") + s.move(library, excludes=["docs/index.rst", "setup.py"]) - code_paths = ["tests/unit/gapic/**/*.py", f"dialogflow_{version}/**/*.py"] - - s.replace(code_paths, "import google.cloud.dialogflow", "import dialogflow") - s.replace(code_paths, "from google.cloud\.", "from ") - s.replace(code_paths, "from google.cloud import", "import") - s.replace(code_paths, "google-cloud-dialogflow", "dialogflow") - s.replace(code_paths, "'-dialogflow'", "'dialogflow'") - s.replace( - code_paths, - "(Returns:\n\s+)([a-zA-Z]+Client:)", - f"\g<1>dialogflow_{version}.\g<2>", - ) - - # Incorrectly formatted "raw" directive content block. - s.replace( - f"dialogflow_{version}/gapic/agents_client.py", - "(\s+).. raw:: html\s+
curl",
-        "\g<1>.. raw:: html\g<1>    
curl",
-    )
-
-# Some files are missing the appropriate utf-8 header
-# -*- coding: utf-8 -*-
-s.replace(
-    [
-        "dialogflow_v2beta1/proto/session_pb2.py",
-        "dialogflow_v2beta1/proto/intent_pb2_grpc.py",
-        "dialogflow_v2/proto/intent_pb2_grpc.py",
-        "dialogflow_v2/proto/session_pb2.py",
-    ],
-    "# Generated by the .*",
-    "# -*- coding: utf-8 -*-\n\g<0>",
-)
-
-s.replace(
-    [
-        "dialogflow_v2beta1/gapic/intents_client.py",
-        "dialogflow_v2beta1/gapic/sessions_client.py",
-        "dialogflow_v2/gapic/intents_client.py",
-    ],
-    "# Copyright 2018 Google LLC",
-    "# -*- coding: utf-8 -*-\n\g<0>",
-)
-
-# Docstring has an extra '\' at the end of it '}\" \'
-s.replace(
-    "dialogflow_v2/gapic/agents_client.py",
-    r"}\\\" [\\]\n(\s+retry \(Optional)",
-    '}\\"\n\g<1>',
+# # ----------------------------------------------------------------------------
+# # Add templated files
+# # ----------------------------------------------------------------------------
+templated_files = common.py_library(
+    samples=False,  # set to True only if there are samples
+    microgenerator=True,
 )
+s.move(templated_files, excludes=[".coveragerc"])  # microgenerator has a good .coveragerc file
 
-# Docstring has '-----' which is interpreted as RST section title
-s.replace("dialogflow_v2beta1/proto/intent_pb2.py", "\s+-----------", "")
-
+# Don't treat warnings as errors
+# Docstrings have unexpected idnentation and block quote formatting issues
 s.replace(
-    "dialogflow_*/proto/session_pb2.py",
-    "============================================================================",
+    "noxfile.py",
+    '''["']-W["'],  # warnings as errors''',
     "",
 )
-
-
-# Replace bad hyperlink references
-s.replace("dialogflow_*/proto/audio_config_pb2.py", "\s*\<\>`__", "`")
-
-
-s.replace("dialogflow_v2/proto/agent_pb2.py", ":math:", "")
-s.replace("dialogflow_v2/proto/agent_pb2.py", ":raw-latex:", "")
-
-# ignore sphinx warnings
-# TODO: remove with microgenerator transition
-s.replace("noxfile.py",
-"""['"]-W['"],  # warnings as errors""",
-"")
-
-# Re-add dropped methods and re-order method args
-# TODO: remove during microgenerator transition
-count = s.replace(
-    "dialogflow_*/**/agents_client.py",
-    """(\s+)def export_agent\(
-(\s+)self,
-\s+parent,
-\s+agent_uri,""",
-    """\g<1>def export_agent(
-        self,
-        parent,
-        agent_uri=None,"""
-)
-
-if count != 1:
-    raise Exception("Required replacement not made.")
-
-count = s.replace(
-    "dialogflow_*/**/agents_client.py",
-    """(\s+)def get_validation_result\(
-(\s+)self,
-\s+parent,""",
-"""\g<1>def get_validation_result(
-        self,
-        parent=None,"""
-)
-
-if count != 2:
-    raise Exception("Required replacement not made.")
-
-
-count = s.replace(
-    "dialogflow_*/**/entity_types_client.py",
-    """@classmethod
-    def agent_path\(cls, project\):""",
-    '''@classmethod
-    def project_agent_path(cls, project):	
-        """Return a fully-qualified project_agent string."""	
-        return google.api_core.path_template.expand(	
-            "projects/{project}/agent", project=project	
-        )
-    
-    @classmethod
-    def agent_path(cls, project):'''
-)
-
-if count != 2:
-    raise Exception("Required replacement not made.")
-
-
-count = s.replace(
-    "dialogflow_*/**/intents_client.py",
-    '''@classmethod
-    def agent_path\(cls, project\):
-        """Return a fully-qualified agent string\."""
-        return google\.api_core\.path_template\.expand\(
-            'projects/{project}/agent',
-            project=project,
-        \)''',
-    '''@classmethod
-    def agent_path(cls, project, agent):
-        """Return a fully-qualified agent string."""
-        return google.api_core.path_template.expand(
-            "projects/{project}/agents/{agent}", project=project, agent=agent
-        )
-
-    @classmethod
-    def project_agent_path(cls, project):
-        """Return a fully-qualified project_agent string."""
-        return google.api_core.path_template.expand(
-            "projects/{project}/agent", project=project
-        )'''
-)
-
-if count != 2:
-    raise Exception("Required replacement not made.")
-
-
-count = s.replace(
-    "dialogflow_v2beta1/**/contexts_client.py",
-    """@classmethod
-    def session_path\(cls, project, session\):""",
-    '''@classmethod	
-    def environment_context_path(cls, project, environment, user, session, context):	
-        """Return a fully-qualified environment_context string."""	
-        return google.api_core.path_template.expand(	
-            "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}",	
-            project=project,	
-            environment=environment,	
-            user=user,	
-            session=session,	
-            context=context,	
-        )	
-
-    @classmethod	
-    def environment_session_path(cls, project, environment, user, session):	
-        """Return a fully-qualified environment_session string."""	
-        return google.api_core.path_template.expand(	
-            "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}",	
-            project=project,	
-            environment=environment,	
-            user=user,	
-            session=session,	
-        )
-
-    @classmethod
-    def session_path(cls, project, session):'''
-)
-
-if count != 1:
-    raise Exception("Required replacement not made.")
-
-
-count = s.replace(
-    "dialogflow_v2beta1/**/documents_client.py",
-    """(\s+)def reload_document\(
-\s+self,
-\s+name,""",
-    """\g<1>def reload_document(
-        self,
-        name=None,"""
-)
-
-if count != 1:
-    raise Exception("Required replacement not made.")
-
-
-count = s.replace(
-    "dialogflow_v2beta1/**/session_entity_types_client.py",
-    """@classmethod
-\s+def session_path\(cls, project, session\):""",
-    '''@classmethod	
-    def environment_session_path(cls, project, environment, user, session):	
-        """Return a fully-qualified environment_session string."""	
-        return google.api_core.path_template.expand(	
-            "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}",	
-            project=project,	
-            environment=environment,	
-            user=user,	
-            session=session,	
-        )	
-
-    @classmethod	
-    def environment_session_entity_type_path(	
-        cls, project, environment, user, session, entity_type	
-    ):	
-        """Return a fully-qualified environment_session_entity_type string."""	
-        return google.api_core.path_template.expand(	
-            "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}",	
-            project=project,	
-            environment=environment,	
-            user=user,	
-            session=session,	
-            entity_type=entity_type,	
-        )
-    
-    @classmethod
-    def session_path(cls, project, session):'''
-)
-
-if count != 1:
-    raise Exception("Required replacement not made.")
-
-count = s.replace(
-    "dialogflow_v2beta1/**/sessions_client.py",
-    """@classmethod
-\s+def session_path\(cls, project, session\):""",
-    '''@classmethod	
-    def environment_session_path(cls, project, environment, user, session):	
-        """Return a fully-qualified environment_session string."""	
-        return google.api_core.path_template.expand(	
-            "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}",	
-            project=project,	
-            environment=environment,	
-            user=user,	
-            session=session,	
-        )
     
-    @classmethod
-    def session_path(cls, project, session):'''
-)
-
-if count != 1:
-    raise Exception("Required replacement not made.")
-
-
-# fix unit test 
-s.replace(
-    "tests/**/test_intents_client_v2.py",
-    """client\.agent_path\('\[PROJECT\]'\)""",
-    """client.agent_path("[PROJECT]", "[AGENT]")""",
-)
-
-# ----------------------------------------------------------------------------
-# Add templated files
-# ----------------------------------------------------------------------------
-templated_files = common.py_library(
-    samples=True,
-)
-s.move(templated_files, excludes=["noxfile.py"])
-
-python.py_samples()
-
 s.shell.run(["nox", "-s", "blacken"], hide_output=False)
diff --git a/tests/unit/gapic/dialogflow_v2/__init__.py b/tests/unit/gapic/dialogflow_v2/__init__.py
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2/__init__.py
@@ -0,0 +1 @@
+
diff --git a/tests/unit/gapic/dialogflow_v2/test_agents.py b/tests/unit/gapic/dialogflow_v2/test_agents.py
new file mode 100644
index 000000000..5d002929d
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2/test_agents.py
@@ -0,0 +1,2607 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import future
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.api_core import operation_async  # type: ignore
+from google.api_core import operations_v1
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2.services.agents import AgentsAsyncClient
+from google.cloud.dialogflow_v2.services.agents import AgentsClient
+from google.cloud.dialogflow_v2.services.agents import pagers
+from google.cloud.dialogflow_v2.services.agents import transports
+from google.cloud.dialogflow_v2.types import agent
+from google.cloud.dialogflow_v2.types import agent as gcd_agent
+from google.cloud.dialogflow_v2.types import validation_result
+from google.longrunning import operations_pb2
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import struct_pb2 as struct  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert AgentsClient._get_default_mtls_endpoint(None) is None
+    assert AgentsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    assert (
+        AgentsClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint
+    )
+    assert (
+        AgentsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        AgentsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_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_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_agents_client_get_transport_class():
+    transport = AgentsClient.get_transport_class()
+    assert transport == transports.AgentsGrpcTransport
+
+    transport = AgentsClient.get_transport_class("grpc")
+    assert transport == transports.AgentsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (AgentsClient, transports.AgentsGrpcTransport, "grpc"),
+        (AgentsAsyncClient, transports.AgentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+@mock.patch.object(
+    AgentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AgentsClient)
+)
+@mock.patch.object(
+    AgentsAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AgentsAsyncClient)
+)
+def test_agents_client_client_options(client_class, transport_class, transport_name):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(AgentsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(AgentsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (AgentsClient, transports.AgentsGrpcTransport, "grpc", "true"),
+        (
+            AgentsAsyncClient,
+            transports.AgentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (AgentsClient, transports.AgentsGrpcTransport, "grpc", "false"),
+        (
+            AgentsAsyncClient,
+            transports.AgentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    AgentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AgentsClient)
+)
+@mock.patch.object(
+    AgentsAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AgentsAsyncClient)
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_agents_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (AgentsClient, transports.AgentsGrpcTransport, "grpc"),
+        (AgentsAsyncClient, transports.AgentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (AgentsClient, transports.AgentsGrpcTransport, "grpc"),
+        (AgentsAsyncClient, transports.AgentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+def test_agents_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_agents_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.agents.transports.AgentsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = AgentsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_get_agent(transport: str = "grpc", request_type=agent.GetAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = agent.Agent(
+            parent="parent_value",
+            display_name="display_name_value",
+            default_language_code="default_language_code_value",
+            supported_language_codes=["supported_language_codes_value"],
+            time_zone="time_zone_value",
+            description="description_value",
+            avatar_uri="avatar_uri_value",
+            enable_logging=True,
+            match_mode=agent.Agent.MatchMode.MATCH_MODE_HYBRID,
+            classification_threshold=0.2552,
+            api_version=agent.Agent.ApiVersion.API_VERSION_V1,
+            tier=agent.Agent.Tier.TIER_STANDARD,
+        )
+
+        response = client.get_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.GetAgentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, agent.Agent)
+
+    assert response.parent == "parent_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.default_language_code == "default_language_code_value"
+
+    assert response.supported_language_codes == ["supported_language_codes_value"]
+
+    assert response.time_zone == "time_zone_value"
+
+    assert response.description == "description_value"
+
+    assert response.avatar_uri == "avatar_uri_value"
+
+    assert response.enable_logging is True
+
+    assert response.match_mode == agent.Agent.MatchMode.MATCH_MODE_HYBRID
+
+    assert math.isclose(response.classification_threshold, 0.2552, rel_tol=1e-6)
+
+    assert response.api_version == agent.Agent.ApiVersion.API_VERSION_V1
+
+    assert response.tier == agent.Agent.Tier.TIER_STANDARD
+
+
+def test_get_agent_from_dict():
+    test_get_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.GetAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            agent.Agent(
+                parent="parent_value",
+                display_name="display_name_value",
+                default_language_code="default_language_code_value",
+                supported_language_codes=["supported_language_codes_value"],
+                time_zone="time_zone_value",
+                description="description_value",
+                avatar_uri="avatar_uri_value",
+                enable_logging=True,
+                match_mode=agent.Agent.MatchMode.MATCH_MODE_HYBRID,
+                classification_threshold=0.2552,
+                api_version=agent.Agent.ApiVersion.API_VERSION_V1,
+                tier=agent.Agent.Tier.TIER_STANDARD,
+            )
+        )
+
+        response = await client.get_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.GetAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, agent.Agent)
+
+    assert response.parent == "parent_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.default_language_code == "default_language_code_value"
+
+    assert response.supported_language_codes == ["supported_language_codes_value"]
+
+    assert response.time_zone == "time_zone_value"
+
+    assert response.description == "description_value"
+
+    assert response.avatar_uri == "avatar_uri_value"
+
+    assert response.enable_logging is True
+
+    assert response.match_mode == agent.Agent.MatchMode.MATCH_MODE_HYBRID
+
+    assert math.isclose(response.classification_threshold, 0.2552, rel_tol=1e-6)
+
+    assert response.api_version == agent.Agent.ApiVersion.API_VERSION_V1
+
+    assert response.tier == agent.Agent.Tier.TIER_STANDARD
+
+
+@pytest.mark.asyncio
+async def test_get_agent_async_from_dict():
+    await test_get_agent_async(request_type=dict)
+
+
+def test_get_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = agent.Agent()
+
+        client.get_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_get_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(agent.Agent())
+
+        await client.get_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_get_agent_flattened():
+    client = AgentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_get_agent_flattened_error():
+    client = AgentsClient(credentials=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(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_agent_flattened_async():
+    client = AgentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = agent.Agent()
+
+        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(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_get_agent_flattened_error_async():
+    client = AgentsAsyncClient(credentials=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(), parent="parent_value",
+        )
+
+
+def test_set_agent(transport: str = "grpc", request_type=gcd_agent.SetAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_agent.Agent(
+            parent="parent_value",
+            display_name="display_name_value",
+            default_language_code="default_language_code_value",
+            supported_language_codes=["supported_language_codes_value"],
+            time_zone="time_zone_value",
+            description="description_value",
+            avatar_uri="avatar_uri_value",
+            enable_logging=True,
+            match_mode=gcd_agent.Agent.MatchMode.MATCH_MODE_HYBRID,
+            classification_threshold=0.2552,
+            api_version=gcd_agent.Agent.ApiVersion.API_VERSION_V1,
+            tier=gcd_agent.Agent.Tier.TIER_STANDARD,
+        )
+
+        response = client.set_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_agent.SetAgentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_agent.Agent)
+
+    assert response.parent == "parent_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.default_language_code == "default_language_code_value"
+
+    assert response.supported_language_codes == ["supported_language_codes_value"]
+
+    assert response.time_zone == "time_zone_value"
+
+    assert response.description == "description_value"
+
+    assert response.avatar_uri == "avatar_uri_value"
+
+    assert response.enable_logging is True
+
+    assert response.match_mode == gcd_agent.Agent.MatchMode.MATCH_MODE_HYBRID
+
+    assert math.isclose(response.classification_threshold, 0.2552, rel_tol=1e-6)
+
+    assert response.api_version == gcd_agent.Agent.ApiVersion.API_VERSION_V1
+
+    assert response.tier == gcd_agent.Agent.Tier.TIER_STANDARD
+
+
+def test_set_agent_from_dict():
+    test_set_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_set_agent_async(
+    transport: str = "grpc_asyncio", request_type=gcd_agent.SetAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_agent.Agent(
+                parent="parent_value",
+                display_name="display_name_value",
+                default_language_code="default_language_code_value",
+                supported_language_codes=["supported_language_codes_value"],
+                time_zone="time_zone_value",
+                description="description_value",
+                avatar_uri="avatar_uri_value",
+                enable_logging=True,
+                match_mode=gcd_agent.Agent.MatchMode.MATCH_MODE_HYBRID,
+                classification_threshold=0.2552,
+                api_version=gcd_agent.Agent.ApiVersion.API_VERSION_V1,
+                tier=gcd_agent.Agent.Tier.TIER_STANDARD,
+            )
+        )
+
+        response = await client.set_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_agent.SetAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_agent.Agent)
+
+    assert response.parent == "parent_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.default_language_code == "default_language_code_value"
+
+    assert response.supported_language_codes == ["supported_language_codes_value"]
+
+    assert response.time_zone == "time_zone_value"
+
+    assert response.description == "description_value"
+
+    assert response.avatar_uri == "avatar_uri_value"
+
+    assert response.enable_logging is True
+
+    assert response.match_mode == gcd_agent.Agent.MatchMode.MATCH_MODE_HYBRID
+
+    assert math.isclose(response.classification_threshold, 0.2552, rel_tol=1e-6)
+
+    assert response.api_version == gcd_agent.Agent.ApiVersion.API_VERSION_V1
+
+    assert response.tier == gcd_agent.Agent.Tier.TIER_STANDARD
+
+
+@pytest.mark.asyncio
+async def test_set_agent_async_from_dict():
+    await test_set_agent_async(request_type=dict)
+
+
+def test_set_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_agent.SetAgentRequest()
+    request.agent.parent = "agent.parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        call.return_value = gcd_agent.Agent()
+
+        client.set_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "agent.parent=agent.parent/value",) in kw[
+        "metadata"
+    ]
+
+
+@pytest.mark.asyncio
+async def test_set_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_agent.SetAgentRequest()
+    request.agent.parent = "agent.parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_agent.Agent())
+
+        await client.set_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "agent.parent=agent.parent/value",) in kw[
+        "metadata"
+    ]
+
+
+def test_set_agent_flattened():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_agent.Agent()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.set_agent(agent=gcd_agent.Agent(parent="parent_value"),)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].agent == gcd_agent.Agent(parent="parent_value")
+
+
+def test_set_agent_flattened_error():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.set_agent(
+            gcd_agent.SetAgentRequest(), agent=gcd_agent.Agent(parent="parent_value"),
+        )
+
+
+@pytest.mark.asyncio
+async def test_set_agent_flattened_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_agent.Agent()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_agent.Agent())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.set_agent(agent=gcd_agent.Agent(parent="parent_value"),)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].agent == gcd_agent.Agent(parent="parent_value")
+
+
+@pytest.mark.asyncio
+async def test_set_agent_flattened_error_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.set_agent(
+            gcd_agent.SetAgentRequest(), agent=gcd_agent.Agent(parent="parent_value"),
+        )
+
+
+def test_delete_agent(transport: str = "grpc", request_type=agent.DeleteAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.DeleteAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_agent_from_dict():
+    test_delete_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.DeleteAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.DeleteAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_agent_async_from_dict():
+    await test_delete_agent_async(request_type=dict)
+
+
+def test_delete_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = None
+
+        client.delete_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_delete_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_delete_agent_flattened():
+    client = AgentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_delete_agent_flattened_error():
+    client = AgentsClient(credentials=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(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_agent_flattened_async():
+    client = AgentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_agent_flattened_error_async():
+    client = AgentsAsyncClient(credentials=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(), parent="parent_value",
+        )
+
+
+def test_search_agents(transport: str = "grpc", request_type=agent.SearchAgentsRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = agent.SearchAgentsResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.search_agents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.SearchAgentsRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.SearchAgentsPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_search_agents_from_dict():
+    test_search_agents(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_search_agents_async(
+    transport: str = "grpc_asyncio", request_type=agent.SearchAgentsRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            agent.SearchAgentsResponse(next_page_token="next_page_token_value",)
+        )
+
+        response = await client.search_agents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.SearchAgentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.SearchAgentsAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_search_agents_async_from_dict():
+    await test_search_agents_async(request_type=dict)
+
+
+def test_search_agents_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.SearchAgentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        call.return_value = agent.SearchAgentsResponse()
+
+        client.search_agents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_search_agents_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.SearchAgentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            agent.SearchAgentsResponse()
+        )
+
+        await client.search_agents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_search_agents_flattened():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = agent.SearchAgentsResponse()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.search_agents(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_search_agents_flattened_error():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.search_agents(
+            agent.SearchAgentsRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_search_agents_flattened_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = agent.SearchAgentsResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            agent.SearchAgentsResponse()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.search_agents(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_search_agents_flattened_error_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.search_agents(
+            agent.SearchAgentsRequest(), parent="parent_value",
+        )
+
+
+def test_search_agents_pager():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            agent.SearchAgentsResponse(
+                agents=[agent.Agent(), agent.Agent(), agent.Agent(),],
+                next_page_token="abc",
+            ),
+            agent.SearchAgentsResponse(agents=[], next_page_token="def",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(), agent.Agent(),],),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.search_agents(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, agent.Agent) for i in results)
+
+
+def test_search_agents_pages():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            agent.SearchAgentsResponse(
+                agents=[agent.Agent(), agent.Agent(), agent.Agent(),],
+                next_page_token="abc",
+            ),
+            agent.SearchAgentsResponse(agents=[], next_page_token="def",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(), agent.Agent(),],),
+            RuntimeError,
+        )
+        pages = list(client.search_agents(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_search_agents_async_pager():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.search_agents), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            agent.SearchAgentsResponse(
+                agents=[agent.Agent(), agent.Agent(), agent.Agent(),],
+                next_page_token="abc",
+            ),
+            agent.SearchAgentsResponse(agents=[], next_page_token="def",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(), agent.Agent(),],),
+            RuntimeError,
+        )
+        async_pager = await client.search_agents(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, agent.Agent) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_search_agents_async_pages():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.search_agents), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            agent.SearchAgentsResponse(
+                agents=[agent.Agent(), agent.Agent(), agent.Agent(),],
+                next_page_token="abc",
+            ),
+            agent.SearchAgentsResponse(agents=[], next_page_token="def",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(), agent.Agent(),],),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.search_agents(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_train_agent(transport: str = "grpc", request_type=agent.TrainAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.train_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.TrainAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_train_agent_from_dict():
+    test_train_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_train_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.TrainAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.train_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.TrainAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_train_agent_async_from_dict():
+    await test_train_agent_async(request_type=dict)
+
+
+def test_train_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.TrainAgentRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.train_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_train_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.TrainAgentRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.train_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_train_agent_flattened():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        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_agent(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_train_agent_flattened_error():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.train_agent(
+            agent.TrainAgentRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_train_agent_flattened_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.train_agent(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_train_agent_flattened_error_async():
+    client = AgentsAsyncClient(credentials=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_agent(
+            agent.TrainAgentRequest(), parent="parent_value",
+        )
+
+
+def test_export_agent(transport: str = "grpc", request_type=agent.ExportAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.export_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.export_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.ExportAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_export_agent_from_dict():
+    test_export_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_export_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.ExportAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.export_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.export_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.ExportAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_export_agent_async_from_dict():
+    await test_export_agent_async(request_type=dict)
+
+
+def test_export_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.export_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_export_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.export_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_export_agent_flattened():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.export_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        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.export_agent(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_export_agent_flattened_error():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.export_agent(
+            agent.ExportAgentRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_export_agent_flattened_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.export_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.export_agent(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_export_agent_flattened_error_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.export_agent(
+            agent.ExportAgentRequest(), parent="parent_value",
+        )
+
+
+def test_import_agent(transport: str = "grpc", request_type=agent.ImportAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.import_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.import_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.ImportAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_import_agent_from_dict():
+    test_import_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_import_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.ImportAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.import_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.import_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.ImportAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_import_agent_async_from_dict():
+    await test_import_agent_async(request_type=dict)
+
+
+def test_import_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.ImportAgentRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.import_agent), "__call__") as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.import_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_import_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.ImportAgentRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.import_agent), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.import_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_restore_agent(transport: str = "grpc", request_type=agent.RestoreAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.restore_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.restore_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.RestoreAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_restore_agent_from_dict():
+    test_restore_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_restore_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.RestoreAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.restore_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.restore_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.RestoreAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_restore_agent_async_from_dict():
+    await test_restore_agent_async(request_type=dict)
+
+
+def test_restore_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.restore_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_restore_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.restore_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_get_validation_result(
+    transport: str = "grpc", request_type=agent.GetValidationResultRequest
+):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_validation_result), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = validation_result.ValidationResult()
+
+        response = client.get_validation_result(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.GetValidationResultRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, validation_result.ValidationResult)
+
+
+def test_get_validation_result_from_dict():
+    test_get_validation_result(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_validation_result_async(
+    transport: str = "grpc_asyncio", request_type=agent.GetValidationResultRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_validation_result), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            validation_result.ValidationResult()
+        )
+
+        response = await client.get_validation_result(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.GetValidationResultRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, validation_result.ValidationResult)
+
+
+@pytest.mark.asyncio
+async def test_get_validation_result_async_from_dict():
+    await test_get_validation_result_async(request_type=dict)
+
+
+def test_get_validation_result_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.GetValidationResultRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_validation_result), "__call__"
+    ) as call:
+        call.return_value = validation_result.ValidationResult()
+
+        client.get_validation_result(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_get_validation_result_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.GetValidationResultRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_validation_result), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            validation_result.ValidationResult()
+        )
+
+        await client.get_validation_result(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.AgentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = AgentsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.AgentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = AgentsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.AgentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = AgentsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.AgentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = AgentsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.AgentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.AgentsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.AgentsGrpcTransport, transports.AgentsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.AgentsGrpcTransport,)
+
+
+def test_agents_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.AgentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_agents_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.agents.transports.AgentsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.AgentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "get_agent",
+        "set_agent",
+        "delete_agent",
+        "search_agents",
+        "train_agent",
+        "export_agent",
+        "import_agent",
+        "restore_agent",
+        "get_validation_result",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+    # Additionally, the LRO client (a property) should
+    # also raise NotImplementedError
+    with pytest.raises(NotImplementedError):
+        transport.operations_client
+
+
+def test_agents_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2.services.agents.transports.AgentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.AgentsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_agents_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2.services.agents.transports.AgentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.AgentsTransport()
+        adc.assert_called_once()
+
+
+def test_agents_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        AgentsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_agents_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.AgentsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_agents_host_no_port():
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_agents_host_with_port():
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_agents_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.AgentsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_agents_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.AgentsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.AgentsGrpcTransport, transports.AgentsGrpcAsyncIOTransport],
+)
+def test_agents_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.AgentsGrpcTransport, transports.AgentsGrpcAsyncIOTransport],
+)
+def test_agents_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_agents_grpc_lro_client():
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport="grpc",
+    )
+    transport = client.transport
+
+    # Ensure that we have a api-core operations client.
+    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
+
+
+def test_agents_grpc_lro_async_client():
+    client = AgentsAsyncClient(
+        credentials=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,)
+
+    # Ensure that subsequent calls to the property send the exact same object.
+    assert transport.operations_client is transport.operations_client
+
+
+def test_agent_path():
+    project = "squid"
+
+    expected = "projects/{project}/agent".format(project=project,)
+    actual = AgentsClient.agent_path(project)
+    assert expected == actual
+
+
+def test_parse_agent_path():
+    expected = {
+        "project": "clam",
+    }
+    path = AgentsClient.agent_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_agent_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "whelk"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = AgentsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "octopus",
+    }
+    path = AgentsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "oyster"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = AgentsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "nudibranch",
+    }
+    path = AgentsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "cuttlefish"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = AgentsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "mussel",
+    }
+    path = AgentsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "winkle"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = AgentsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "nautilus",
+    }
+    path = AgentsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "scallop"
+    location = "abalone"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = AgentsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "squid",
+        "location": "clam",
+    }
+    path = AgentsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.AgentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = AgentsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.AgentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = AgentsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2/test_contexts.py b/tests/unit/gapic/dialogflow_v2/test_contexts.py
new file mode 100644
index 000000000..19de6f43c
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2/test_contexts.py
@@ -0,0 +1,2148 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2.services.contexts import ContextsAsyncClient
+from google.cloud.dialogflow_v2.services.contexts import ContextsClient
+from google.cloud.dialogflow_v2.services.contexts import pagers
+from google.cloud.dialogflow_v2.services.contexts import transports
+from google.cloud.dialogflow_v2.types import context
+from google.cloud.dialogflow_v2.types import context as gcd_context
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import struct_pb2 as struct  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert ContextsClient._get_default_mtls_endpoint(None) is None
+    assert ContextsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    assert (
+        ContextsClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        ContextsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        ContextsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert ContextsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi
+
+
+@pytest.mark.parametrize("client_class", [ContextsClient, ContextsAsyncClient])
+def test_contexts_client_from_service_account_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_contexts_client_get_transport_class():
+    transport = ContextsClient.get_transport_class()
+    assert transport == transports.ContextsGrpcTransport
+
+    transport = ContextsClient.get_transport_class("grpc")
+    assert transport == transports.ContextsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (ContextsClient, transports.ContextsGrpcTransport, "grpc"),
+        (ContextsAsyncClient, transports.ContextsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+@mock.patch.object(
+    ContextsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ContextsClient)
+)
+@mock.patch.object(
+    ContextsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(ContextsAsyncClient),
+)
+def test_contexts_client_client_options(client_class, transport_class, transport_name):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(ContextsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(ContextsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (ContextsClient, transports.ContextsGrpcTransport, "grpc", "true"),
+        (
+            ContextsAsyncClient,
+            transports.ContextsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (ContextsClient, transports.ContextsGrpcTransport, "grpc", "false"),
+        (
+            ContextsAsyncClient,
+            transports.ContextsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    ContextsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ContextsClient)
+)
+@mock.patch.object(
+    ContextsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(ContextsAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_contexts_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (ContextsClient, transports.ContextsGrpcTransport, "grpc"),
+        (ContextsAsyncClient, transports.ContextsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+def test_contexts_client_client_options_scopes(
+    client_class, transport_class, transport_name
+):
+    # Check the case scopes are provided.
+    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)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (ContextsClient, transports.ContextsGrpcTransport, "grpc"),
+        (ContextsAsyncClient, transports.ContextsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+def test_contexts_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_contexts_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.contexts.transports.ContextsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = ContextsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_contexts(
+    transport: str = "grpc", request_type=context.ListContextsRequest
+):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.ListContextsResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.ListContextsRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListContextsPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_contexts_from_dict():
+    test_list_contexts(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_async(
+    transport: str = "grpc_asyncio", request_type=context.ListContextsRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            context.ListContextsResponse(next_page_token="next_page_token_value",)
+        )
+
+        response = await client.list_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.ListContextsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListContextsAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_async_from_dict():
+    await test_list_contexts_async(request_type=dict)
+
+
+def test_list_contexts_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.ListContextsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        call.return_value = context.ListContextsResponse()
+
+        client.list_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.ListContextsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            context.ListContextsResponse()
+        )
+
+        await client.list_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_contexts_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.ListContextsResponse()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.list_contexts(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_list_contexts_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.list_contexts(
+            context.ListContextsRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.ListContextsResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            context.ListContextsResponse()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.list_contexts(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_flattened_error_async():
+    client = ContextsAsyncClient(credentials=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_contexts(
+            context.ListContextsRequest(), parent="parent_value",
+        )
+
+
+def test_list_contexts_pager():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(), context.Context(),],
+                next_page_token="abc",
+            ),
+            context.ListContextsResponse(contexts=[], next_page_token="def",),
+            context.ListContextsResponse(
+                contexts=[context.Context(),], next_page_token="ghi",
+            ),
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(),],
+            ),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_contexts(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, context.Context) for i in results)
+
+
+def test_list_contexts_pages():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(), context.Context(),],
+                next_page_token="abc",
+            ),
+            context.ListContextsResponse(contexts=[], next_page_token="def",),
+            context.ListContextsResponse(
+                contexts=[context.Context(),], next_page_token="ghi",
+            ),
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(),],
+            ),
+            RuntimeError,
+        )
+        pages = list(client.list_contexts(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_async_pager():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_contexts), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(), context.Context(),],
+                next_page_token="abc",
+            ),
+            context.ListContextsResponse(contexts=[], next_page_token="def",),
+            context.ListContextsResponse(
+                contexts=[context.Context(),], next_page_token="ghi",
+            ),
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(),],
+            ),
+            RuntimeError,
+        )
+        async_pager = await client.list_contexts(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, context.Context) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_async_pages():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_contexts), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(), context.Context(),],
+                next_page_token="abc",
+            ),
+            context.ListContextsResponse(contexts=[], next_page_token="def",),
+            context.ListContextsResponse(
+                contexts=[context.Context(),], next_page_token="ghi",
+            ),
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(),],
+            ),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_contexts(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_get_context(transport: str = "grpc", request_type=context.GetContextRequest):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.Context(name="name_value", lifespan_count=1498,)
+
+        response = client.get_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.GetContextRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+def test_get_context_from_dict():
+    test_get_context(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_context_async(
+    transport: str = "grpc_asyncio", request_type=context.GetContextRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            context.Context(name="name_value", lifespan_count=1498,)
+        )
+
+        response = await client.get_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.GetContextRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+@pytest.mark.asyncio
+async def test_get_context_async_from_dict():
+    await test_get_context_async(request_type=dict)
+
+
+def test_get_context_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.GetContextRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        call.return_value = context.Context()
+
+        client.get_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_get_context_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.GetContextRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(context.Context())
+
+        await client.get_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_get_context_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.Context()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.get_context(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_get_context_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.get_context(
+            context.GetContextRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_context_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.Context()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(context.Context())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.get_context(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_get_context_flattened_error_async():
+    client = ContextsAsyncClient(credentials=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_context(
+            context.GetContextRequest(), name="name_value",
+        )
+
+
+def test_create_context(
+    transport: str = "grpc", request_type=gcd_context.CreateContextRequest
+):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context(name="name_value", lifespan_count=1498,)
+
+        response = client.create_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_context.CreateContextRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+def test_create_context_from_dict():
+    test_create_context(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_create_context_async(
+    transport: str = "grpc_asyncio", request_type=gcd_context.CreateContextRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_context.Context(name="name_value", lifespan_count=1498,)
+        )
+
+        response = await client.create_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_context.CreateContextRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+@pytest.mark.asyncio
+async def test_create_context_async_from_dict():
+    await test_create_context_async(request_type=dict)
+
+
+def test_create_context_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_context.CreateContextRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        call.return_value = gcd_context.Context()
+
+        client.create_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_create_context_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_context.CreateContextRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_context.Context())
+
+        await client.create_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_create_context_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.create_context(
+            parent="parent_value", context=gcd_context.Context(name="name_value"),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].context == gcd_context.Context(name="name_value")
+
+
+def test_create_context_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.create_context(
+            gcd_context.CreateContextRequest(),
+            parent="parent_value",
+            context=gcd_context.Context(name="name_value"),
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_context_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_context.Context())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.create_context(
+            parent="parent_value", context=gcd_context.Context(name="name_value"),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].context == gcd_context.Context(name="name_value")
+
+
+@pytest.mark.asyncio
+async def test_create_context_flattened_error_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.create_context(
+            gcd_context.CreateContextRequest(),
+            parent="parent_value",
+            context=gcd_context.Context(name="name_value"),
+        )
+
+
+def test_update_context(
+    transport: str = "grpc", request_type=gcd_context.UpdateContextRequest
+):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context(name="name_value", lifespan_count=1498,)
+
+        response = client.update_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_context.UpdateContextRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+def test_update_context_from_dict():
+    test_update_context(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_update_context_async(
+    transport: str = "grpc_asyncio", request_type=gcd_context.UpdateContextRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_context.Context(name="name_value", lifespan_count=1498,)
+        )
+
+        response = await client.update_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_context.UpdateContextRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+@pytest.mark.asyncio
+async def test_update_context_async_from_dict():
+    await test_update_context_async(request_type=dict)
+
+
+def test_update_context_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_context.UpdateContextRequest()
+    request.context.name = "context.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        call.return_value = gcd_context.Context()
+
+        client.update_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "context.name=context.name/value",) in kw[
+        "metadata"
+    ]
+
+
+@pytest.mark.asyncio
+async def test_update_context_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_context.UpdateContextRequest()
+    request.context.name = "context.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_context.Context())
+
+        await client.update_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "context.name=context.name/value",) in kw[
+        "metadata"
+    ]
+
+
+def test_update_context_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.update_context(
+            context=gcd_context.Context(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].context == gcd_context.Context(name="name_value")
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+def test_update_context_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.update_context(
+            gcd_context.UpdateContextRequest(),
+            context=gcd_context.Context(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+@pytest.mark.asyncio
+async def test_update_context_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_context.Context())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.update_context(
+            context=gcd_context.Context(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].context == gcd_context.Context(name="name_value")
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+@pytest.mark.asyncio
+async def test_update_context_flattened_error_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.update_context(
+            gcd_context.UpdateContextRequest(),
+            context=gcd_context.Context(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+def test_delete_context(
+    transport: str = "grpc", request_type=context.DeleteContextRequest
+):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.DeleteContextRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_context_from_dict():
+    test_delete_context(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_context_async(
+    transport: str = "grpc_asyncio", request_type=context.DeleteContextRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.DeleteContextRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_context_async_from_dict():
+    await test_delete_context_async(request_type=dict)
+
+
+def test_delete_context_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.DeleteContextRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        call.return_value = None
+
+        client.delete_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_delete_context_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.DeleteContextRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_delete_context_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.delete_context(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_delete_context_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.delete_context(
+            context.DeleteContextRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_context_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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_context(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_context_flattened_error_async():
+    client = ContextsAsyncClient(credentials=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_context(
+            context.DeleteContextRequest(), name="name_value",
+        )
+
+
+def test_delete_all_contexts(
+    transport: str = "grpc", request_type=context.DeleteAllContextsRequest
+):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_all_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.DeleteAllContextsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_all_contexts_from_dict():
+    test_delete_all_contexts(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_all_contexts_async(
+    transport: str = "grpc_asyncio", request_type=context.DeleteAllContextsRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_all_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.DeleteAllContextsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_all_contexts_async_from_dict():
+    await test_delete_all_contexts_async(request_type=dict)
+
+
+def test_delete_all_contexts_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.DeleteAllContextsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        call.return_value = None
+
+        client.delete_all_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_delete_all_contexts_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.DeleteAllContextsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_all_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_delete_all_contexts_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.delete_all_contexts(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_delete_all_contexts_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.delete_all_contexts(
+            context.DeleteAllContextsRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_all_contexts_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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_all_contexts(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_all_contexts_flattened_error_async():
+    client = ContextsAsyncClient(credentials=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_all_contexts(
+            context.DeleteAllContextsRequest(), parent="parent_value",
+        )
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.ContextsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = ContextsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.ContextsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = ContextsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.ContextsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = ContextsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.ContextsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = ContextsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.ContextsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.ContextsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.ContextsGrpcTransport, transports.ContextsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.ContextsGrpcTransport,)
+
+
+def test_contexts_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.ContextsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_contexts_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.contexts.transports.ContextsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.ContextsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "list_contexts",
+        "get_context",
+        "create_context",
+        "update_context",
+        "delete_context",
+        "delete_all_contexts",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+
+def test_contexts_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2.services.contexts.transports.ContextsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.ContextsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_contexts_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2.services.contexts.transports.ContextsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.ContextsTransport()
+        adc.assert_called_once()
+
+
+def test_contexts_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        ContextsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_contexts_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.ContextsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_contexts_host_no_port():
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_contexts_host_with_port():
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_contexts_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.ContextsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_contexts_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.ContextsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.ContextsGrpcTransport, transports.ContextsGrpcAsyncIOTransport],
+)
+def test_contexts_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.ContextsGrpcTransport, transports.ContextsGrpcAsyncIOTransport],
+)
+def test_contexts_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_context_path():
+    project = "squid"
+    session = "clam"
+    context = "whelk"
+
+    expected = "projects/{project}/agent/sessions/{session}/contexts/{context}".format(
+        project=project, session=session, context=context,
+    )
+    actual = ContextsClient.context_path(project, session, context)
+    assert expected == actual
+
+
+def test_parse_context_path():
+    expected = {
+        "project": "octopus",
+        "session": "oyster",
+        "context": "nudibranch",
+    }
+    path = ContextsClient.context_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_context_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "cuttlefish"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = ContextsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "mussel",
+    }
+    path = ContextsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "winkle"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = ContextsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "nautilus",
+    }
+    path = ContextsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "scallop"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = ContextsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "abalone",
+    }
+    path = ContextsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "squid"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = ContextsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "clam",
+    }
+    path = ContextsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "whelk"
+    location = "octopus"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = ContextsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "oyster",
+        "location": "nudibranch",
+    }
+    path = ContextsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.ContextsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = ContextsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.ContextsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = ContextsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2/test_entity_types.py b/tests/unit/gapic/dialogflow_v2/test_entity_types.py
new file mode 100644
index 000000000..73470ed98
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2/test_entity_types.py
@@ -0,0 +1,3230 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import future
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.api_core import operation_async  # type: ignore
+from google.api_core import operations_v1
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2.services.entity_types import EntityTypesAsyncClient
+from google.cloud.dialogflow_v2.services.entity_types import EntityTypesClient
+from google.cloud.dialogflow_v2.services.entity_types import pagers
+from google.cloud.dialogflow_v2.services.entity_types import transports
+from google.cloud.dialogflow_v2.types import entity_type
+from google.cloud.dialogflow_v2.types import entity_type as gcd_entity_type
+from google.longrunning import operations_pb2
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import struct_pb2 as struct  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert EntityTypesClient._get_default_mtls_endpoint(None) is None
+    assert (
+        EntityTypesClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    )
+    assert (
+        EntityTypesClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        EntityTypesClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        EntityTypesClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_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_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_entity_types_client_get_transport_class():
+    transport = EntityTypesClient.get_transport_class()
+    assert transport == transports.EntityTypesGrpcTransport
+
+    transport = EntityTypesClient.get_transport_class("grpc")
+    assert transport == transports.EntityTypesGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EntityTypesClient, transports.EntityTypesGrpcTransport, "grpc"),
+        (
+            EntityTypesAsyncClient,
+            transports.EntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+@mock.patch.object(
+    EntityTypesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(EntityTypesClient)
+)
+@mock.patch.object(
+    EntityTypesAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(EntityTypesAsyncClient),
+)
+def test_entity_types_client_client_options(
+    client_class, transport_class, transport_name
+):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(EntityTypesClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(EntityTypesClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (EntityTypesClient, transports.EntityTypesGrpcTransport, "grpc", "true"),
+        (
+            EntityTypesAsyncClient,
+            transports.EntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (EntityTypesClient, transports.EntityTypesGrpcTransport, "grpc", "false"),
+        (
+            EntityTypesAsyncClient,
+            transports.EntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    EntityTypesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(EntityTypesClient)
+)
+@mock.patch.object(
+    EntityTypesAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(EntityTypesAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_entity_types_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EntityTypesClient, transports.EntityTypesGrpcTransport, "grpc"),
+        (
+            EntityTypesAsyncClient,
+            transports.EntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EntityTypesClient, transports.EntityTypesGrpcTransport, "grpc"),
+        (
+            EntityTypesAsyncClient,
+            transports.EntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+def test_entity_types_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_entity_types_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.entity_types.transports.EntityTypesGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = EntityTypesClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_entity_types(
+    transport: str = "grpc", request_type=entity_type.ListEntityTypesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = entity_type.ListEntityTypesResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.ListEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListEntityTypesPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_entity_types_from_dict():
+    test_list_entity_types(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.ListEntityTypesRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.ListEntityTypesResponse(
+                next_page_token="next_page_token_value",
+            )
+        )
+
+        response = await client.list_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.ListEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListEntityTypesAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_async_from_dict():
+    await test_list_entity_types_async(request_type=dict)
+
+
+def test_list_entity_types_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        call.return_value = entity_type.ListEntityTypesResponse()
+
+        client.list_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.ListEntityTypesResponse()
+        )
+
+        await client.list_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_entity_types_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_list_entity_types_flattened_error():
+    client = EntityTypesClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = entity_type.ListEntityTypesResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.ListEntityTypesResponse()
+        )
+        # 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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+def test_list_entity_types_pager():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            entity_type.ListEntityTypesResponse(
+                entity_types=[
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[], next_page_token="def",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(),], next_page_token="ghi",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(), entity_type.EntityType(),],
+            ),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_entity_types(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, entity_type.EntityType) for i in results)
+
+
+def test_list_entity_types_pages():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            entity_type.ListEntityTypesResponse(
+                entity_types=[
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[], next_page_token="def",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(),], next_page_token="ghi",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(), entity_type.EntityType(),],
+            ),
+            RuntimeError,
+        )
+        pages = list(client.list_entity_types(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_async_pager():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            entity_type.ListEntityTypesResponse(
+                entity_types=[
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[], next_page_token="def",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(),], next_page_token="ghi",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(), entity_type.EntityType(),],
+            ),
+            RuntimeError,
+        )
+        async_pager = await client.list_entity_types(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, entity_type.EntityType) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_async_pages():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            entity_type.ListEntityTypesResponse(
+                entity_types=[
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[], next_page_token="def",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(),], next_page_token="ghi",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(), entity_type.EntityType(),],
+            ),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_entity_types(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_get_entity_type(
+    transport: str = "grpc", request_type=entity_type.GetEntityTypeRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # 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:
+        # Designate an appropriate return value for the call.
+        call.return_value = entity_type.EntityType(
+            name="name_value",
+            display_name="display_name_value",
+            kind=entity_type.EntityType.Kind.KIND_MAP,
+            auto_expansion_mode=entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+            enable_fuzzy_extraction=True,
+        )
+
+        response = client.get_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.GetEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+def test_get_entity_type_from_dict():
+    test_get_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_entity_type_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.GetEntityTypeRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # 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:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.EntityType(
+                name="name_value",
+                display_name="display_name_value",
+                kind=entity_type.EntityType.Kind.KIND_MAP,
+                auto_expansion_mode=entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+                enable_fuzzy_extraction=True,
+            )
+        )
+
+        response = await client.get_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.GetEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+@pytest.mark.asyncio
+async def test_get_entity_type_async_from_dict():
+    await test_get_entity_type_async(request_type=dict)
+
+
+def test_get_entity_type_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # 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:
+        call.return_value = entity_type.EntityType()
+
+        client.get_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # 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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.EntityType()
+        )
+
+        await client.get_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_get_entity_type_flattened():
+    client = EntityTypesClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_get_entity_type_flattened_error():
+    client = EntityTypesClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_entity_type_flattened_async():
+    client = EntityTypesAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = entity_type.EntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.EntityType()
+        )
+        # 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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_get_entity_type_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+def test_create_entity_type(
+    transport: str = "grpc", request_type=gcd_entity_type.CreateEntityTypeRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType(
+            name="name_value",
+            display_name="display_name_value",
+            kind=gcd_entity_type.EntityType.Kind.KIND_MAP,
+            auto_expansion_mode=gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+            enable_fuzzy_extraction=True,
+        )
+
+        response = client.create_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_entity_type.CreateEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == gcd_entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+def test_create_entity_type_from_dict():
+    test_create_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_create_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=gcd_entity_type.CreateEntityTypeRequest,
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType(
+                name="name_value",
+                display_name="display_name_value",
+                kind=gcd_entity_type.EntityType.Kind.KIND_MAP,
+                auto_expansion_mode=gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+                enable_fuzzy_extraction=True,
+            )
+        )
+
+        response = await client.create_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_entity_type.CreateEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == gcd_entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+@pytest.mark.asyncio
+async def test_create_entity_type_async_from_dict():
+    await test_create_entity_type_async(request_type=dict)
+
+
+def test_create_entity_type_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_entity_type.CreateEntityTypeRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        call.return_value = gcd_entity_type.EntityType()
+
+        client.create_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_entity_type.CreateEntityTypeRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType()
+        )
+
+        await client.create_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_create_entity_type_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.create_entity_type(
+            parent="parent_value",
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_type == gcd_entity_type.EntityType(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_create_entity_type_flattened_error():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.create_entity_type(
+            gcd_entity_type.CreateEntityTypeRequest(),
+            parent="parent_value",
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_entity_type_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.create_entity_type(
+            parent="parent_value",
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_type == gcd_entity_type.EntityType(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_create_entity_type_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.create_entity_type(
+            gcd_entity_type.CreateEntityTypeRequest(),
+            parent="parent_value",
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+
+def test_update_entity_type(
+    transport: str = "grpc", request_type=gcd_entity_type.UpdateEntityTypeRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType(
+            name="name_value",
+            display_name="display_name_value",
+            kind=gcd_entity_type.EntityType.Kind.KIND_MAP,
+            auto_expansion_mode=gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+            enable_fuzzy_extraction=True,
+        )
+
+        response = client.update_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_entity_type.UpdateEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == gcd_entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+def test_update_entity_type_from_dict():
+    test_update_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_update_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=gcd_entity_type.UpdateEntityTypeRequest,
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType(
+                name="name_value",
+                display_name="display_name_value",
+                kind=gcd_entity_type.EntityType.Kind.KIND_MAP,
+                auto_expansion_mode=gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+                enable_fuzzy_extraction=True,
+            )
+        )
+
+        response = await client.update_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_entity_type.UpdateEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == gcd_entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+@pytest.mark.asyncio
+async def test_update_entity_type_async_from_dict():
+    await test_update_entity_type_async(request_type=dict)
+
+
+def test_update_entity_type_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_entity_type.UpdateEntityTypeRequest()
+    request.entity_type.name = "entity_type.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        call.return_value = gcd_entity_type.EntityType()
+
+        client.update_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # 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"
+    ]
+
+
+@pytest.mark.asyncio
+async def test_update_entity_type_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_entity_type.UpdateEntityTypeRequest()
+    request.entity_type.name = "entity_type.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType()
+        )
+
+        await client.update_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # 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"
+    ]
+
+
+def test_update_entity_type_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.update_entity_type(
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].entity_type == gcd_entity_type.EntityType(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_update_entity_type_flattened_error():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.update_entity_type(
+            gcd_entity_type.UpdateEntityTypeRequest(),
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_update_entity_type_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.update_entity_type(
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].entity_type == gcd_entity_type.EntityType(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_update_entity_type_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.update_entity_type(
+            gcd_entity_type.UpdateEntityTypeRequest(),
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+
+def test_delete_entity_type(
+    transport: str = "grpc", request_type=entity_type.DeleteEntityTypeRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.DeleteEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_entity_type_from_dict():
+    test_delete_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_entity_type_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.DeleteEntityTypeRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.DeleteEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_entity_type_async_from_dict():
+    await test_delete_entity_type_async(request_type=dict)
+
+
+def test_delete_entity_type_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        call.return_value = None
+
+        client.delete_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_delete_entity_type_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_delete_entity_type_flattened_error():
+    client = EntityTypesClient(credentials=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",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_entity_type_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_entity_type_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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",
+        )
+
+
+def test_batch_update_entity_types(
+    transport: str = "grpc", request_type=entity_type.BatchUpdateEntityTypesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_update_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchUpdateEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_update_entity_types_from_dict():
+    test_batch_update_entity_types(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entity_types_async(
+    transport: str = "grpc_asyncio",
+    request_type=entity_type.BatchUpdateEntityTypesRequest,
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_update_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchUpdateEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entity_types_async_from_dict():
+    await test_batch_update_entity_types_async(request_type=dict)
+
+
+def test_batch_update_entity_types_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entity_types), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_update_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entity_types_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entity_types), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_update_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_delete_entity_types(
+    transport: str = "grpc", request_type=entity_type.BatchDeleteEntityTypesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_delete_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchDeleteEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_delete_entity_types_from_dict():
+    test_batch_delete_entity_types(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entity_types_async(
+    transport: str = "grpc_asyncio",
+    request_type=entity_type.BatchDeleteEntityTypesRequest,
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_delete_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchDeleteEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entity_types_async_from_dict():
+    await test_batch_delete_entity_types_async(request_type=dict)
+
+
+def test_batch_delete_entity_types_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_delete_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entity_types_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_delete_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_delete_entity_types_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_delete_entity_types(
+            parent="parent_value", entity_type_names=["entity_type_names_value"],
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_type_names == ["entity_type_names_value"]
+
+
+def test_batch_delete_entity_types_flattened_error():
+    client = EntityTypesClient(credentials=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_entity_types(
+            entity_type.BatchDeleteEntityTypesRequest(),
+            parent="parent_value",
+            entity_type_names=["entity_type_names_value"],
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entity_types_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_delete_entity_types(
+            parent="parent_value", entity_type_names=["entity_type_names_value"],
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_type_names == ["entity_type_names_value"]
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entity_types_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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_entity_types(
+            entity_type.BatchDeleteEntityTypesRequest(),
+            parent="parent_value",
+            entity_type_names=["entity_type_names_value"],
+        )
+
+
+def test_batch_create_entities(
+    transport: str = "grpc", request_type=entity_type.BatchCreateEntitiesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_create_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchCreateEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_create_entities_from_dict():
+    test_batch_create_entities(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_create_entities_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.BatchCreateEntitiesRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_create_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchCreateEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_create_entities_async_from_dict():
+    await test_batch_create_entities_async(request_type=dict)
+
+
+def test_batch_create_entities_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchCreateEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_create_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_create_entities_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchCreateEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_create_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_create_entities_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_create_entities(
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entities == [entity_type.EntityType.Entity(value="value_value")]
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_batch_create_entities_flattened_error():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.batch_create_entities(
+            entity_type.BatchCreateEntitiesRequest(),
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_create_entities_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_create_entities(
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entities == [entity_type.EntityType.Entity(value="value_value")]
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_batch_create_entities_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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_create_entities(
+            entity_type.BatchCreateEntitiesRequest(),
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+
+def test_batch_update_entities(
+    transport: str = "grpc", request_type=entity_type.BatchUpdateEntitiesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_update_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchUpdateEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_update_entities_from_dict():
+    test_batch_update_entities(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entities_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.BatchUpdateEntitiesRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_update_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchUpdateEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entities_async_from_dict():
+    await test_batch_update_entities_async(request_type=dict)
+
+
+def test_batch_update_entities_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_update_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entities_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_update_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_update_entities_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_update_entities(
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entities == [entity_type.EntityType.Entity(value="value_value")]
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_batch_update_entities_flattened_error():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.batch_update_entities(
+            entity_type.BatchUpdateEntitiesRequest(),
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entities_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_update_entities(
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entities == [entity_type.EntityType.Entity(value="value_value")]
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entities_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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_update_entities(
+            entity_type.BatchUpdateEntitiesRequest(),
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+
+def test_batch_delete_entities(
+    transport: str = "grpc", request_type=entity_type.BatchDeleteEntitiesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_delete_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchDeleteEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_delete_entities_from_dict():
+    test_batch_delete_entities(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entities_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.BatchDeleteEntitiesRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_delete_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchDeleteEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entities_async_from_dict():
+    await test_batch_delete_entities_async(request_type=dict)
+
+
+def test_batch_delete_entities_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_delete_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entities_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_delete_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_delete_entities_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_delete_entities(
+            parent="parent_value",
+            entity_values=["entity_values_value"],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_values == ["entity_values_value"]
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_batch_delete_entities_flattened_error():
+    client = EntityTypesClient(credentials=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_entities(
+            entity_type.BatchDeleteEntitiesRequest(),
+            parent="parent_value",
+            entity_values=["entity_values_value"],
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entities_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_delete_entities(
+            parent="parent_value",
+            entity_values=["entity_values_value"],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_values == ["entity_values_value"]
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entities_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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_entities(
+            entity_type.BatchDeleteEntitiesRequest(),
+            parent="parent_value",
+            entity_values=["entity_values_value"],
+            language_code="language_code_value",
+        )
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.EntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EntityTypesClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.EntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EntityTypesClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.EntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EntityTypesClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.EntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = EntityTypesClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.EntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.EntityTypesGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EntityTypesGrpcTransport, transports.EntityTypesGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.EntityTypesGrpcTransport,)
+
+
+def test_entity_types_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.EntityTypesTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_entity_types_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.entity_types.transports.EntityTypesTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.EntityTypesTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "list_entity_types",
+        "get_entity_type",
+        "create_entity_type",
+        "update_entity_type",
+        "delete_entity_type",
+        "batch_update_entity_types",
+        "batch_delete_entity_types",
+        "batch_create_entities",
+        "batch_update_entities",
+        "batch_delete_entities",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+    # Additionally, the LRO client (a property) should
+    # also raise NotImplementedError
+    with pytest.raises(NotImplementedError):
+        transport.operations_client
+
+
+def test_entity_types_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2.services.entity_types.transports.EntityTypesTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.EntityTypesTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_entity_types_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2.services.entity_types.transports.EntityTypesTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.EntityTypesTransport()
+        adc.assert_called_once()
+
+
+def test_entity_types_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        EntityTypesClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_entity_types_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.EntityTypesGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_entity_types_host_no_port():
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_entity_types_host_with_port():
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_entity_types_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.EntityTypesGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_entity_types_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.EntityTypesGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EntityTypesGrpcTransport, transports.EntityTypesGrpcAsyncIOTransport],
+)
+def test_entity_types_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EntityTypesGrpcTransport, transports.EntityTypesGrpcAsyncIOTransport],
+)
+def test_entity_types_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_entity_types_grpc_lro_client():
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport="grpc",
+    )
+    transport = client.transport
+
+    # Ensure that we have a api-core operations client.
+    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
+
+
+def test_entity_types_grpc_lro_async_client():
+    client = EntityTypesAsyncClient(
+        credentials=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,)
+
+    # Ensure that subsequent calls to the property send the exact same object.
+    assert transport.operations_client is transport.operations_client
+
+
+def test_entity_type_path():
+    project = "squid"
+    entity_type = "clam"
+
+    expected = "projects/{project}/agent/entityTypes/{entity_type}".format(
+        project=project, entity_type=entity_type,
+    )
+    actual = EntityTypesClient.entity_type_path(project, entity_type)
+    assert expected == actual
+
+
+def test_parse_entity_type_path():
+    expected = {
+        "project": "whelk",
+        "entity_type": "octopus",
+    }
+    path = EntityTypesClient.entity_type_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_entity_type_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "oyster"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = EntityTypesClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "nudibranch",
+    }
+    path = EntityTypesClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "cuttlefish"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = EntityTypesClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "mussel",
+    }
+    path = EntityTypesClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "winkle"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = EntityTypesClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "nautilus",
+    }
+    path = EntityTypesClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "scallop"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = EntityTypesClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "abalone",
+    }
+    path = EntityTypesClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "squid"
+    location = "clam"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = EntityTypesClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "whelk",
+        "location": "octopus",
+    }
+    path = EntityTypesClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.EntityTypesTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = EntityTypesClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.EntityTypesTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = EntityTypesClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2/test_environments.py b/tests/unit/gapic/dialogflow_v2/test_environments.py
new file mode 100644
index 000000000..dbc909037
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2/test_environments.py
@@ -0,0 +1,1154 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2.services.environments import EnvironmentsAsyncClient
+from google.cloud.dialogflow_v2.services.environments import EnvironmentsClient
+from google.cloud.dialogflow_v2.services.environments import pagers
+from google.cloud.dialogflow_v2.services.environments import transports
+from google.cloud.dialogflow_v2.types import environment
+from google.oauth2 import service_account
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert EnvironmentsClient._get_default_mtls_endpoint(None) is None
+    assert (
+        EnvironmentsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    )
+    assert (
+        EnvironmentsClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        EnvironmentsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        EnvironmentsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_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_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_environments_client_get_transport_class():
+    transport = EnvironmentsClient.get_transport_class()
+    assert transport == transports.EnvironmentsGrpcTransport
+
+    transport = EnvironmentsClient.get_transport_class("grpc")
+    assert transport == transports.EnvironmentsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EnvironmentsClient, transports.EnvironmentsGrpcTransport, "grpc"),
+        (
+            EnvironmentsAsyncClient,
+            transports.EnvironmentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+@mock.patch.object(
+    EnvironmentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(EnvironmentsClient)
+)
+@mock.patch.object(
+    EnvironmentsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(EnvironmentsAsyncClient),
+)
+def test_environments_client_client_options(
+    client_class, transport_class, transport_name
+):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(EnvironmentsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(EnvironmentsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (EnvironmentsClient, transports.EnvironmentsGrpcTransport, "grpc", "true"),
+        (
+            EnvironmentsAsyncClient,
+            transports.EnvironmentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (EnvironmentsClient, transports.EnvironmentsGrpcTransport, "grpc", "false"),
+        (
+            EnvironmentsAsyncClient,
+            transports.EnvironmentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    EnvironmentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(EnvironmentsClient)
+)
+@mock.patch.object(
+    EnvironmentsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(EnvironmentsAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_environments_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EnvironmentsClient, transports.EnvironmentsGrpcTransport, "grpc"),
+        (
+            EnvironmentsAsyncClient,
+            transports.EnvironmentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EnvironmentsClient, transports.EnvironmentsGrpcTransport, "grpc"),
+        (
+            EnvironmentsAsyncClient,
+            transports.EnvironmentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+def test_environments_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_environments_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.environments.transports.EnvironmentsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = EnvironmentsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_environments(
+    transport: str = "grpc", request_type=environment.ListEnvironmentsRequest
+):
+    client = EnvironmentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = environment.ListEnvironmentsResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_environments(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == environment.ListEnvironmentsRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListEnvironmentsPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_environments_from_dict():
+    test_list_environments(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_environments_async(
+    transport: str = "grpc_asyncio", request_type=environment.ListEnvironmentsRequest
+):
+    client = EnvironmentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            environment.ListEnvironmentsResponse(
+                next_page_token="next_page_token_value",
+            )
+        )
+
+        response = await client.list_environments(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == environment.ListEnvironmentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListEnvironmentsAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_environments_async_from_dict():
+    await test_list_environments_async(request_type=dict)
+
+
+def test_list_environments_field_headers():
+    client = EnvironmentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        call.return_value = environment.ListEnvironmentsResponse()
+
+        client.list_environments(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            environment.ListEnvironmentsResponse()
+        )
+
+        await client.list_environments(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_environments_pager():
+    client = EnvironmentsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            environment.ListEnvironmentsResponse(
+                environments=[
+                    environment.Environment(),
+                    environment.Environment(),
+                    environment.Environment(),
+                ],
+                next_page_token="abc",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[], next_page_token="def",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(),], next_page_token="ghi",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(), environment.Environment(),],
+            ),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_environments(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, environment.Environment) for i in results)
+
+
+def test_list_environments_pages():
+    client = EnvironmentsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            environment.ListEnvironmentsResponse(
+                environments=[
+                    environment.Environment(),
+                    environment.Environment(),
+                    environment.Environment(),
+                ],
+                next_page_token="abc",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[], next_page_token="def",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(),], next_page_token="ghi",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(), environment.Environment(),],
+            ),
+            RuntimeError,
+        )
+        pages = list(client.list_environments(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_environments_async_pager():
+    client = EnvironmentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            environment.ListEnvironmentsResponse(
+                environments=[
+                    environment.Environment(),
+                    environment.Environment(),
+                    environment.Environment(),
+                ],
+                next_page_token="abc",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[], next_page_token="def",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(),], next_page_token="ghi",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(), environment.Environment(),],
+            ),
+            RuntimeError,
+        )
+        async_pager = await client.list_environments(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, environment.Environment) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_list_environments_async_pages():
+    client = EnvironmentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            environment.ListEnvironmentsResponse(
+                environments=[
+                    environment.Environment(),
+                    environment.Environment(),
+                    environment.Environment(),
+                ],
+                next_page_token="abc",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[], next_page_token="def",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(),], next_page_token="ghi",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(), environment.Environment(),],
+            ),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_environments(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.EnvironmentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EnvironmentsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.EnvironmentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EnvironmentsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.EnvironmentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EnvironmentsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.EnvironmentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = EnvironmentsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.EnvironmentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.EnvironmentsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EnvironmentsGrpcTransport, transports.EnvironmentsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = EnvironmentsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.EnvironmentsGrpcTransport,)
+
+
+def test_environments_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.EnvironmentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_environments_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.environments.transports.EnvironmentsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.EnvironmentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = ("list_environments",)
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+
+def test_environments_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2.services.environments.transports.EnvironmentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.EnvironmentsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_environments_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2.services.environments.transports.EnvironmentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.EnvironmentsTransport()
+        adc.assert_called_once()
+
+
+def test_environments_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        EnvironmentsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_environments_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.EnvironmentsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_environments_host_no_port():
+    client = EnvironmentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_environments_host_with_port():
+    client = EnvironmentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_environments_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.EnvironmentsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_environments_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.EnvironmentsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EnvironmentsGrpcTransport, transports.EnvironmentsGrpcAsyncIOTransport],
+)
+def test_environments_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EnvironmentsGrpcTransport, transports.EnvironmentsGrpcAsyncIOTransport],
+)
+def test_environments_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_environment_path():
+    project = "squid"
+    environment = "clam"
+
+    expected = "projects/{project}/agent/environments/{environment}".format(
+        project=project, environment=environment,
+    )
+    actual = EnvironmentsClient.environment_path(project, environment)
+    assert expected == actual
+
+
+def test_parse_environment_path():
+    expected = {
+        "project": "whelk",
+        "environment": "octopus",
+    }
+    path = EnvironmentsClient.environment_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_environment_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "oyster"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = EnvironmentsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "nudibranch",
+    }
+    path = EnvironmentsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "cuttlefish"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = EnvironmentsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "mussel",
+    }
+    path = EnvironmentsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "winkle"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = EnvironmentsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "nautilus",
+    }
+    path = EnvironmentsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "scallop"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = EnvironmentsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "abalone",
+    }
+    path = EnvironmentsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "squid"
+    location = "clam"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = EnvironmentsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "whelk",
+        "location": "octopus",
+    }
+    path = EnvironmentsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.EnvironmentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = EnvironmentsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.EnvironmentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = EnvironmentsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2/test_intents.py b/tests/unit/gapic/dialogflow_v2/test_intents.py
new file mode 100644
index 000000000..624876705
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2/test_intents.py
@@ -0,0 +1,2717 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import future
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.api_core import operation_async  # type: ignore
+from google.api_core import operations_v1
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2.services.intents import IntentsAsyncClient
+from google.cloud.dialogflow_v2.services.intents import IntentsClient
+from google.cloud.dialogflow_v2.services.intents import pagers
+from google.cloud.dialogflow_v2.services.intents import transports
+from google.cloud.dialogflow_v2.types import context
+from google.cloud.dialogflow_v2.types import intent
+from google.cloud.dialogflow_v2.types import intent as gcd_intent
+from google.longrunning import operations_pb2
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import struct_pb2 as struct  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert IntentsClient._get_default_mtls_endpoint(None) is None
+    assert IntentsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    assert (
+        IntentsClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint
+    )
+    assert (
+        IntentsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        IntentsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_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_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_intents_client_get_transport_class():
+    transport = IntentsClient.get_transport_class()
+    assert transport == transports.IntentsGrpcTransport
+
+    transport = IntentsClient.get_transport_class("grpc")
+    assert transport == transports.IntentsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (IntentsClient, transports.IntentsGrpcTransport, "grpc"),
+        (IntentsAsyncClient, transports.IntentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+@mock.patch.object(
+    IntentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(IntentsClient)
+)
+@mock.patch.object(
+    IntentsAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(IntentsAsyncClient)
+)
+def test_intents_client_client_options(client_class, transport_class, transport_name):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(IntentsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(IntentsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (IntentsClient, transports.IntentsGrpcTransport, "grpc", "true"),
+        (
+            IntentsAsyncClient,
+            transports.IntentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (IntentsClient, transports.IntentsGrpcTransport, "grpc", "false"),
+        (
+            IntentsAsyncClient,
+            transports.IntentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    IntentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(IntentsClient)
+)
+@mock.patch.object(
+    IntentsAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(IntentsAsyncClient)
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_intents_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (IntentsClient, transports.IntentsGrpcTransport, "grpc"),
+        (IntentsAsyncClient, transports.IntentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (IntentsClient, transports.IntentsGrpcTransport, "grpc"),
+        (IntentsAsyncClient, transports.IntentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+def test_intents_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_intents_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.intents.transports.IntentsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = IntentsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_intents(transport: str = "grpc", request_type=intent.ListIntentsRequest):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_intents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = intent.ListIntentsResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.ListIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListIntentsPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_intents_from_dict():
+    test_list_intents(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_intents_async(
+    transport: str = "grpc_asyncio", request_type=intent.ListIntentsRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    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",)
+        )
+
+        response = await client.list_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.ListIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListIntentsAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_intents_async_from_dict():
+    await test_list_intents_async(request_type=dict)
+
+
+def test_list_intents_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_intents), "__call__") as call:
+        call.return_value = intent.ListIntentsResponse()
+
+        client.list_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_intents), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            intent.ListIntentsResponse()
+        )
+
+        await client.list_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_intents_flattened():
+    client = IntentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_list_intents_flattened_error():
+    client = IntentsClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_intents_flattened_async():
+    client = IntentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = intent.ListIntentsResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            intent.ListIntentsResponse()
+        )
+        # 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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_list_intents_flattened_error_async():
+    client = IntentsAsyncClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+def test_list_intents_pager():
+    client = IntentsClient(credentials=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:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            intent.ListIntentsResponse(
+                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",
+            ),
+            intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_intents(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, intent.Intent) for i in results)
+
+
+def test_list_intents_pages():
+    client = IntentsClient(credentials=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:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            intent.ListIntentsResponse(
+                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",
+            ),
+            intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],),
+            RuntimeError,
+        )
+        pages = list(client.list_intents(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_intents_async_pager():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_intents), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            intent.ListIntentsResponse(
+                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",
+            ),
+            intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],),
+            RuntimeError,
+        )
+        async_pager = await client.list_intents(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, intent.Intent) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_list_intents_async_pages():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_intents), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            intent.ListIntentsResponse(
+                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",
+            ),
+            intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_intents(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_get_intent(transport: str = "grpc", request_type=intent.GetIntentRequest):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = intent.Intent(
+            name="name_value",
+            display_name="display_name_value",
+            webhook_state=intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+            priority=898,
+            is_fallback=True,
+            ml_disabled=True,
+            input_context_names=["input_context_names_value"],
+            events=["events_value"],
+            action="action_value",
+            reset_contexts=True,
+            default_response_platforms=[intent.Intent.Message.Platform.FACEBOOK],
+            root_followup_intent_name="root_followup_intent_name_value",
+            parent_followup_intent_name="parent_followup_intent_name_value",
+        )
+
+        response = client.get_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.GetIntentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.webhook_state == intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_disabled is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+def test_get_intent_from_dict():
+    test_get_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_intent_async(
+    transport: str = "grpc_asyncio", request_type=intent.GetIntentRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            intent.Intent(
+                name="name_value",
+                display_name="display_name_value",
+                webhook_state=intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+                priority=898,
+                is_fallback=True,
+                ml_disabled=True,
+                input_context_names=["input_context_names_value"],
+                events=["events_value"],
+                action="action_value",
+                reset_contexts=True,
+                default_response_platforms=[intent.Intent.Message.Platform.FACEBOOK],
+                root_followup_intent_name="root_followup_intent_name_value",
+                parent_followup_intent_name="parent_followup_intent_name_value",
+            )
+        )
+
+        response = await client.get_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.GetIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.webhook_state == intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_disabled is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+@pytest.mark.asyncio
+async def test_get_intent_async_from_dict():
+    await test_get_intent_async(request_type=dict)
+
+
+def test_get_intent_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_intent), "__call__") as call:
+        call.return_value = intent.Intent()
+
+        client.get_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_intent), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(intent.Intent())
+
+        await client.get_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_get_intent_flattened():
+    client = IntentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_get_intent_flattened_error():
+    client = IntentsClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_intent_flattened_async():
+    client = IntentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = intent.Intent()
+
+        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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_get_intent_flattened_error_async():
+    client = IntentsAsyncClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+def test_create_intent(
+    transport: str = "grpc", request_type=gcd_intent.CreateIntentRequest
+):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent(
+            name="name_value",
+            display_name="display_name_value",
+            webhook_state=gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+            priority=898,
+            is_fallback=True,
+            ml_disabled=True,
+            input_context_names=["input_context_names_value"],
+            events=["events_value"],
+            action="action_value",
+            reset_contexts=True,
+            default_response_platforms=[gcd_intent.Intent.Message.Platform.FACEBOOK],
+            root_followup_intent_name="root_followup_intent_name_value",
+            parent_followup_intent_name="parent_followup_intent_name_value",
+        )
+
+        response = client.create_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_intent.CreateIntentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert (
+        response.webhook_state == gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+    )
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_disabled is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        gcd_intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+def test_create_intent_from_dict():
+    test_create_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_create_intent_async(
+    transport: str = "grpc_asyncio", request_type=gcd_intent.CreateIntentRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_intent.Intent(
+                name="name_value",
+                display_name="display_name_value",
+                webhook_state=gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+                priority=898,
+                is_fallback=True,
+                ml_disabled=True,
+                input_context_names=["input_context_names_value"],
+                events=["events_value"],
+                action="action_value",
+                reset_contexts=True,
+                default_response_platforms=[
+                    gcd_intent.Intent.Message.Platform.FACEBOOK
+                ],
+                root_followup_intent_name="root_followup_intent_name_value",
+                parent_followup_intent_name="parent_followup_intent_name_value",
+            )
+        )
+
+        response = await client.create_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_intent.CreateIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert (
+        response.webhook_state == gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+    )
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_disabled is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        gcd_intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+@pytest.mark.asyncio
+async def test_create_intent_async_from_dict():
+    await test_create_intent_async(request_type=dict)
+
+
+def test_create_intent_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_intent.CreateIntentRequest()
+    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:
+        call.return_value = gcd_intent.Intent()
+
+        client.create_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_intent.CreateIntentRequest()
+    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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_intent.Intent())
+
+        await client.create_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_create_intent_flattened():
+    client = IntentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent()
+
+        # 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=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intent == gcd_intent.Intent(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_create_intent_flattened_error():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.create_intent(
+            gcd_intent.CreateIntentRequest(),
+            parent="parent_value",
+            intent=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_intent_flattened_async():
+    client = IntentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_intent.Intent())
+        # 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=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intent == gcd_intent.Intent(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_create_intent_flattened_error_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.create_intent(
+            gcd_intent.CreateIntentRequest(),
+            parent="parent_value",
+            intent=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+        )
+
+
+def test_update_intent(
+    transport: str = "grpc", request_type=gcd_intent.UpdateIntentRequest
+):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent(
+            name="name_value",
+            display_name="display_name_value",
+            webhook_state=gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+            priority=898,
+            is_fallback=True,
+            ml_disabled=True,
+            input_context_names=["input_context_names_value"],
+            events=["events_value"],
+            action="action_value",
+            reset_contexts=True,
+            default_response_platforms=[gcd_intent.Intent.Message.Platform.FACEBOOK],
+            root_followup_intent_name="root_followup_intent_name_value",
+            parent_followup_intent_name="parent_followup_intent_name_value",
+        )
+
+        response = client.update_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_intent.UpdateIntentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert (
+        response.webhook_state == gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+    )
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_disabled is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        gcd_intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+def test_update_intent_from_dict():
+    test_update_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_update_intent_async(
+    transport: str = "grpc_asyncio", request_type=gcd_intent.UpdateIntentRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_intent.Intent(
+                name="name_value",
+                display_name="display_name_value",
+                webhook_state=gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+                priority=898,
+                is_fallback=True,
+                ml_disabled=True,
+                input_context_names=["input_context_names_value"],
+                events=["events_value"],
+                action="action_value",
+                reset_contexts=True,
+                default_response_platforms=[
+                    gcd_intent.Intent.Message.Platform.FACEBOOK
+                ],
+                root_followup_intent_name="root_followup_intent_name_value",
+                parent_followup_intent_name="parent_followup_intent_name_value",
+            )
+        )
+
+        response = await client.update_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_intent.UpdateIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert (
+        response.webhook_state == gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+    )
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_disabled is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        gcd_intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+@pytest.mark.asyncio
+async def test_update_intent_async_from_dict():
+    await test_update_intent_async(request_type=dict)
+
+
+def test_update_intent_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_intent.UpdateIntentRequest()
+    request.intent.name = "intent.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:
+        call.return_value = gcd_intent.Intent()
+
+        client.update_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # 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"]
+
+
+@pytest.mark.asyncio
+async def test_update_intent_field_headers_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_intent.UpdateIntentRequest()
+    request.intent.name = "intent.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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_intent.Intent())
+
+        await client.update_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # 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"]
+
+
+def test_update_intent_flattened():
+    client = IntentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.update_intent(
+            intent=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].intent == gcd_intent.Intent(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+def test_update_intent_flattened_error():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.update_intent(
+            gcd_intent.UpdateIntentRequest(),
+            intent=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+@pytest.mark.asyncio
+async def test_update_intent_flattened_async():
+    client = IntentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_intent.Intent())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.update_intent(
+            intent=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].intent == gcd_intent.Intent(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+@pytest.mark.asyncio
+async def test_update_intent_flattened_error_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.update_intent(
+            gcd_intent.UpdateIntentRequest(),
+            intent=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+def test_delete_intent(
+    transport: str = "grpc", request_type=intent.DeleteIntentRequest
+):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.DeleteIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_intent_from_dict():
+    test_delete_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_intent_async(
+    transport: str = "grpc_asyncio", request_type=intent.DeleteIntentRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.DeleteIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_intent_async_from_dict():
+    await test_delete_intent_async(request_type=dict)
+
+
+def test_delete_intent_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_intent), "__call__") as call:
+        call.return_value = None
+
+        client.delete_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_intent), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_delete_intent_flattened():
+    client = IntentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_delete_intent_flattened_error():
+    client = IntentsClient(credentials=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",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_intent_flattened_async():
+    client = IntentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_intent_flattened_error_async():
+    client = IntentsAsyncClient(credentials=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",
+        )
+
+
+def test_batch_update_intents(
+    transport: str = "grpc", request_type=intent.BatchUpdateIntentsRequest
+):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_update_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.BatchUpdateIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_update_intents_from_dict():
+    test_batch_update_intents(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_intents_async(
+    transport: str = "grpc_asyncio", request_type=intent.BatchUpdateIntentsRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_update_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.BatchUpdateIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_intents_async_from_dict():
+    await test_batch_update_intents_async(request_type=dict)
+
+
+def test_batch_update_intents_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateIntentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_update_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_update_intents_field_headers_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateIntentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_update_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_update_intents_flattened():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_update_intents(
+            parent="parent_value",
+            intent_batch_uri="intent_batch_uri_value",
+            intent_batch_inline=intent.IntentBatch(
+                intents=[intent.Intent(name="name_value")]
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intent_batch_inline == intent.IntentBatch(
+            intents=[intent.Intent(name="name_value")]
+        )
+
+
+def test_batch_update_intents_flattened_error():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.batch_update_intents(
+            intent.BatchUpdateIntentsRequest(),
+            parent="parent_value",
+            intent_batch_uri="intent_batch_uri_value",
+            intent_batch_inline=intent.IntentBatch(
+                intents=[intent.Intent(name="name_value")]
+            ),
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_update_intents_flattened_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_update_intents(
+            parent="parent_value",
+            intent_batch_uri="intent_batch_uri_value",
+            intent_batch_inline=intent.IntentBatch(
+                intents=[intent.Intent(name="name_value")]
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intent_batch_inline == intent.IntentBatch(
+            intents=[intent.Intent(name="name_value")]
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_update_intents_flattened_error_async():
+    client = IntentsAsyncClient(credentials=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_update_intents(
+            intent.BatchUpdateIntentsRequest(),
+            parent="parent_value",
+            intent_batch_uri="intent_batch_uri_value",
+            intent_batch_inline=intent.IntentBatch(
+                intents=[intent.Intent(name="name_value")]
+            ),
+        )
+
+
+def test_batch_delete_intents(
+    transport: str = "grpc", request_type=intent.BatchDeleteIntentsRequest
+):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_delete_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.BatchDeleteIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_delete_intents_from_dict():
+    test_batch_delete_intents(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_intents_async(
+    transport: str = "grpc_asyncio", request_type=intent.BatchDeleteIntentsRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_delete_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.BatchDeleteIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_intents_async_from_dict():
+    await test_batch_delete_intents_async(request_type=dict)
+
+
+def test_batch_delete_intents_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteIntentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_delete_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_intents_field_headers_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteIntentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_delete_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_delete_intents_flattened():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_delete_intents(
+            parent="parent_value", intents=[intent.Intent(name="name_value")],
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intents == [intent.Intent(name="name_value")]
+
+
+def test_batch_delete_intents_flattened_error():
+    client = IntentsClient(credentials=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_intents(
+            intent.BatchDeleteIntentsRequest(),
+            parent="parent_value",
+            intents=[intent.Intent(name="name_value")],
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_intents_flattened_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_delete_intents(
+            parent="parent_value", intents=[intent.Intent(name="name_value")],
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intents == [intent.Intent(name="name_value")]
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_intents_flattened_error_async():
+    client = IntentsAsyncClient(credentials=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_intents(
+            intent.BatchDeleteIntentsRequest(),
+            parent="parent_value",
+            intents=[intent.Intent(name="name_value")],
+        )
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.IntentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = IntentsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.IntentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = IntentsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.IntentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = IntentsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.IntentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = IntentsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.IntentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.IntentsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.IntentsGrpcTransport, transports.IntentsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.IntentsGrpcTransport,)
+
+
+def test_intents_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.IntentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_intents_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.intents.transports.IntentsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.IntentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "list_intents",
+        "get_intent",
+        "create_intent",
+        "update_intent",
+        "delete_intent",
+        "batch_update_intents",
+        "batch_delete_intents",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+    # Additionally, the LRO client (a property) should
+    # also raise NotImplementedError
+    with pytest.raises(NotImplementedError):
+        transport.operations_client
+
+
+def test_intents_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2.services.intents.transports.IntentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.IntentsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_intents_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2.services.intents.transports.IntentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.IntentsTransport()
+        adc.assert_called_once()
+
+
+def test_intents_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        IntentsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_intents_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.IntentsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_intents_host_no_port():
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_intents_host_with_port():
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_intents_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.IntentsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_intents_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.IntentsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.IntentsGrpcTransport, transports.IntentsGrpcAsyncIOTransport],
+)
+def test_intents_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.IntentsGrpcTransport, transports.IntentsGrpcAsyncIOTransport],
+)
+def test_intents_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_intents_grpc_lro_client():
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport="grpc",
+    )
+    transport = client.transport
+
+    # Ensure that we have a api-core operations client.
+    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
+
+
+def test_intents_grpc_lro_async_client():
+    client = IntentsAsyncClient(
+        credentials=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,)
+
+    # Ensure that subsequent calls to the property send the exact same object.
+    assert transport.operations_client is transport.operations_client
+
+
+def test_context_path():
+    project = "squid"
+    session = "clam"
+    context = "whelk"
+
+    expected = "projects/{project}/agent/sessions/{session}/contexts/{context}".format(
+        project=project, session=session, context=context,
+    )
+    actual = IntentsClient.context_path(project, session, context)
+    assert expected == actual
+
+
+def test_parse_context_path():
+    expected = {
+        "project": "octopus",
+        "session": "oyster",
+        "context": "nudibranch",
+    }
+    path = IntentsClient.context_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_context_path(path)
+    assert expected == actual
+
+
+def test_intent_path():
+    project = "cuttlefish"
+    intent = "mussel"
+
+    expected = "projects/{project}/agent/intents/{intent}".format(
+        project=project, intent=intent,
+    )
+    actual = IntentsClient.intent_path(project, intent)
+    assert expected == actual
+
+
+def test_parse_intent_path():
+    expected = {
+        "project": "winkle",
+        "intent": "nautilus",
+    }
+    path = IntentsClient.intent_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_intent_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "scallop"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = IntentsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "abalone",
+    }
+    path = IntentsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "squid"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = IntentsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "clam",
+    }
+    path = IntentsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "whelk"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = IntentsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "octopus",
+    }
+    path = IntentsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "oyster"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = IntentsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "nudibranch",
+    }
+    path = IntentsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "cuttlefish"
+    location = "mussel"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = IntentsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "winkle",
+        "location": "nautilus",
+    }
+    path = IntentsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.IntentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = IntentsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.IntentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = IntentsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2/test_session_entity_types.py b/tests/unit/gapic/dialogflow_v2/test_session_entity_types.py
new file mode 100644
index 000000000..d52c2dcdd
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2/test_session_entity_types.py
@@ -0,0 +1,2248 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2.services.session_entity_types import (
+    SessionEntityTypesAsyncClient,
+)
+from google.cloud.dialogflow_v2.services.session_entity_types import (
+    SessionEntityTypesClient,
+)
+from google.cloud.dialogflow_v2.services.session_entity_types import pagers
+from google.cloud.dialogflow_v2.services.session_entity_types import transports
+from google.cloud.dialogflow_v2.types import entity_type
+from google.cloud.dialogflow_v2.types import session_entity_type
+from google.cloud.dialogflow_v2.types import (
+    session_entity_type as gcd_session_entity_type,
+)
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert SessionEntityTypesClient._get_default_mtls_endpoint(None) is None
+    assert (
+        SessionEntityTypesClient._get_default_mtls_endpoint(api_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        SessionEntityTypesClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        SessionEntityTypesClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        SessionEntityTypesClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        SessionEntityTypesClient._get_default_mtls_endpoint(non_googleapi)
+        == non_googleapi
+    )
+
+
+@pytest.mark.parametrize(
+    "client_class", [SessionEntityTypesClient, SessionEntityTypesAsyncClient]
+)
+def test_session_entity_types_client_from_service_account_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_session_entity_types_client_get_transport_class():
+    transport = SessionEntityTypesClient.get_transport_class()
+    assert transport == transports.SessionEntityTypesGrpcTransport
+
+    transport = SessionEntityTypesClient.get_transport_class("grpc")
+    assert transport == transports.SessionEntityTypesGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionEntityTypesClient, transports.SessionEntityTypesGrpcTransport, "grpc"),
+        (
+            SessionEntityTypesAsyncClient,
+            transports.SessionEntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+@mock.patch.object(
+    SessionEntityTypesClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionEntityTypesClient),
+)
+@mock.patch.object(
+    SessionEntityTypesAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionEntityTypesAsyncClient),
+)
+def test_session_entity_types_client_client_options(
+    client_class, transport_class, transport_name
+):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(SessionEntityTypesClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(SessionEntityTypesClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (
+            SessionEntityTypesClient,
+            transports.SessionEntityTypesGrpcTransport,
+            "grpc",
+            "true",
+        ),
+        (
+            SessionEntityTypesAsyncClient,
+            transports.SessionEntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (
+            SessionEntityTypesClient,
+            transports.SessionEntityTypesGrpcTransport,
+            "grpc",
+            "false",
+        ),
+        (
+            SessionEntityTypesAsyncClient,
+            transports.SessionEntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    SessionEntityTypesClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionEntityTypesClient),
+)
+@mock.patch.object(
+    SessionEntityTypesAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionEntityTypesAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_session_entity_types_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionEntityTypesClient, transports.SessionEntityTypesGrpcTransport, "grpc"),
+        (
+            SessionEntityTypesAsyncClient,
+            transports.SessionEntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionEntityTypesClient, transports.SessionEntityTypesGrpcTransport, "grpc"),
+        (
+            SessionEntityTypesAsyncClient,
+            transports.SessionEntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+def test_session_entity_types_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_session_entity_types_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.session_entity_types.transports.SessionEntityTypesGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = SessionEntityTypesClient(
+            client_options={"api_endpoint": "squid.clam.whelk"}
+        )
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_session_entity_types(
+    transport: str = "grpc",
+    request_type=session_entity_type.ListSessionEntityTypesRequest,
+):
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = session_entity_type.ListSessionEntityTypesResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_session_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.ListSessionEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListSessionEntityTypesPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_session_entity_types_from_dict():
+    test_list_session_entity_types(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_async(
+    transport: str = "grpc_asyncio",
+    request_type=session_entity_type.ListSessionEntityTypesRequest,
+):
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.ListSessionEntityTypesResponse(
+                next_page_token="next_page_token_value",
+            )
+        )
+
+        response = await client.list_session_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.ListSessionEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListSessionEntityTypesAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_async_from_dict():
+    await test_list_session_entity_types_async(request_type=dict)
+
+
+def test_list_session_entity_types_field_headers():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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_entity_type.ListSessionEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        call.return_value = session_entity_type.ListSessionEntityTypesResponse()
+
+        client.list_session_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_field_headers_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Any value 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_entity_type.ListSessionEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.ListSessionEntityTypesResponse()
+        )
+
+        await client.list_session_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_session_entity_types_flattened():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_list_session_entity_types_flattened_error():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.list_session_entity_types(
+            session_entity_type.ListSessionEntityTypesRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_flattened_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = session_entity_type.ListSessionEntityTypesResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.ListSessionEntityTypesResponse()
+        )
+        # 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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_flattened_error_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=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_session_entity_types(
+            session_entity_type.ListSessionEntityTypesRequest(), parent="parent_value",
+        )
+
+
+def test_list_session_entity_types_pager():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[], next_page_token="def",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[session_entity_type.SessionEntityType(),],
+                next_page_token="ghi",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+            ),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_session_entity_types(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(
+            isinstance(i, session_entity_type.SessionEntityType) for i in results
+        )
+
+
+def test_list_session_entity_types_pages():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[], next_page_token="def",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[session_entity_type.SessionEntityType(),],
+                next_page_token="ghi",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+            ),
+            RuntimeError,
+        )
+        pages = list(client.list_session_entity_types(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_async_pager():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials,
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[], next_page_token="def",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[session_entity_type.SessionEntityType(),],
+                next_page_token="ghi",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+            ),
+            RuntimeError,
+        )
+        async_pager = await client.list_session_entity_types(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(
+            isinstance(i, session_entity_type.SessionEntityType) for i in responses
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_async_pages():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials,
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[], next_page_token="def",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[session_entity_type.SessionEntityType(),],
+                next_page_token="ghi",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+            ),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_session_entity_types(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_get_session_entity_type(
+    transport: str = "grpc",
+    request_type=session_entity_type.GetSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = session_entity_type.SessionEntityType(
+            name="name_value",
+            entity_override_mode=session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+        )
+
+        response = client.get_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.GetSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+def test_get_session_entity_type_from_dict():
+    test_get_session_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_session_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=session_entity_type.GetSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.SessionEntityType(
+                name="name_value",
+                entity_override_mode=session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+            )
+        )
+
+        response = await client.get_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.GetSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+@pytest.mark.asyncio
+async def test_get_session_entity_type_async_from_dict():
+    await test_get_session_entity_type_async(request_type=dict)
+
+
+def test_get_session_entity_type_field_headers():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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_entity_type.GetSessionEntityTypeRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = session_entity_type.SessionEntityType()
+
+        client.get_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_get_session_entity_type_field_headers_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Any value 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_entity_type.GetSessionEntityTypeRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.SessionEntityType()
+        )
+
+        await client.get_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_get_session_entity_type_flattened():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_get_session_entity_type_flattened_error():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.get_session_entity_type(
+            session_entity_type.GetSessionEntityTypeRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_session_entity_type_flattened_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = session_entity_type.SessionEntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.SessionEntityType()
+        )
+        # 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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_get_session_entity_type_flattened_error_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=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_session_entity_type(
+            session_entity_type.GetSessionEntityTypeRequest(), name="name_value",
+        )
+
+
+def test_create_session_entity_type(
+    transport: str = "grpc",
+    request_type=gcd_session_entity_type.CreateSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType(
+            name="name_value",
+            entity_override_mode=gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+        )
+
+        response = client.create_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session_entity_type.CreateSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+def test_create_session_entity_type_from_dict():
+    test_create_session_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_create_session_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=gcd_session_entity_type.CreateSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType(
+                name="name_value",
+                entity_override_mode=gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+            )
+        )
+
+        response = await client.create_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session_entity_type.CreateSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+@pytest.mark.asyncio
+async def test_create_session_entity_type_async_from_dict():
+    await test_create_session_entity_type_async(request_type=dict)
+
+
+def test_create_session_entity_type_field_headers():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session_entity_type.CreateSessionEntityTypeRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        client.create_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_create_session_entity_type_field_headers_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session_entity_type.CreateSessionEntityTypeRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType()
+        )
+
+        await client.create_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_create_session_entity_type_flattened():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.create_session_entity_type(
+            parent="parent_value",
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].session_entity_type == gcd_session_entity_type.SessionEntityType(
+            name="name_value"
+        )
+
+
+def test_create_session_entity_type_flattened_error():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.create_session_entity_type(
+            gcd_session_entity_type.CreateSessionEntityTypeRequest(),
+            parent="parent_value",
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_session_entity_type_flattened_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.create_session_entity_type(
+            parent="parent_value",
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].session_entity_type == gcd_session_entity_type.SessionEntityType(
+            name="name_value"
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_session_entity_type_flattened_error_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.create_session_entity_type(
+            gcd_session_entity_type.CreateSessionEntityTypeRequest(),
+            parent="parent_value",
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+        )
+
+
+def test_update_session_entity_type(
+    transport: str = "grpc",
+    request_type=gcd_session_entity_type.UpdateSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType(
+            name="name_value",
+            entity_override_mode=gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+        )
+
+        response = client.update_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session_entity_type.UpdateSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+def test_update_session_entity_type_from_dict():
+    test_update_session_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_update_session_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=gcd_session_entity_type.UpdateSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType(
+                name="name_value",
+                entity_override_mode=gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+            )
+        )
+
+        response = await client.update_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session_entity_type.UpdateSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+@pytest.mark.asyncio
+async def test_update_session_entity_type_async_from_dict():
+    await test_update_session_entity_type_async(request_type=dict)
+
+
+def test_update_session_entity_type_field_headers():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session_entity_type.UpdateSessionEntityTypeRequest()
+    request.session_entity_type.name = "session_entity_type.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        client.update_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert (
+        "x-goog-request-params",
+        "session_entity_type.name=session_entity_type.name/value",
+    ) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_update_session_entity_type_field_headers_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session_entity_type.UpdateSessionEntityTypeRequest()
+    request.session_entity_type.name = "session_entity_type.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType()
+        )
+
+        await client.update_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert (
+        "x-goog-request-params",
+        "session_entity_type.name=session_entity_type.name/value",
+    ) in kw["metadata"]
+
+
+def test_update_session_entity_type_flattened():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.update_session_entity_type(
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].session_entity_type == gcd_session_entity_type.SessionEntityType(
+            name="name_value"
+        )
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+def test_update_session_entity_type_flattened_error():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.update_session_entity_type(
+            gcd_session_entity_type.UpdateSessionEntityTypeRequest(),
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+@pytest.mark.asyncio
+async def test_update_session_entity_type_flattened_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.update_session_entity_type(
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].session_entity_type == gcd_session_entity_type.SessionEntityType(
+            name="name_value"
+        )
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+@pytest.mark.asyncio
+async def test_update_session_entity_type_flattened_error_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.update_session_entity_type(
+            gcd_session_entity_type.UpdateSessionEntityTypeRequest(),
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+def test_delete_session_entity_type(
+    transport: str = "grpc",
+    request_type=session_entity_type.DeleteSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.DeleteSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_session_entity_type_from_dict():
+    test_delete_session_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_session_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=session_entity_type.DeleteSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.DeleteSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_session_entity_type_async_from_dict():
+    await test_delete_session_entity_type_async(request_type=dict)
+
+
+def test_delete_session_entity_type_field_headers():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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_entity_type.DeleteSessionEntityTypeRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = None
+
+        client.delete_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_delete_session_entity_type_field_headers_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Any value 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_entity_type.DeleteSessionEntityTypeRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_delete_session_entity_type_flattened():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_delete_session_entity_type_flattened_error():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.delete_session_entity_type(
+            session_entity_type.DeleteSessionEntityTypeRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_session_entity_type_flattened_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_session_entity_type_flattened_error_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=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_session_entity_type(
+            session_entity_type.DeleteSessionEntityTypeRequest(), name="name_value",
+        )
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionEntityTypesClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionEntityTypesClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionEntityTypesClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = SessionEntityTypesClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.SessionEntityTypesGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [
+        transports.SessionEntityTypesGrpcTransport,
+        transports.SessionEntityTypesGrpcAsyncIOTransport,
+    ],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.SessionEntityTypesGrpcTransport,)
+
+
+def test_session_entity_types_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.SessionEntityTypesTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_session_entity_types_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.session_entity_types.transports.SessionEntityTypesTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.SessionEntityTypesTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "list_session_entity_types",
+        "get_session_entity_type",
+        "create_session_entity_type",
+        "update_session_entity_type",
+        "delete_session_entity_type",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+
+def test_session_entity_types_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2.services.session_entity_types.transports.SessionEntityTypesTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.SessionEntityTypesTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_session_entity_types_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2.services.session_entity_types.transports.SessionEntityTypesTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.SessionEntityTypesTransport()
+        adc.assert_called_once()
+
+
+def test_session_entity_types_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        SessionEntityTypesClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_session_entity_types_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.SessionEntityTypesGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_session_entity_types_host_no_port():
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_session_entity_types_host_with_port():
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_session_entity_types_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_session_entity_types_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.SessionEntityTypesGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [
+        transports.SessionEntityTypesGrpcTransport,
+        transports.SessionEntityTypesGrpcAsyncIOTransport,
+    ],
+)
+def test_session_entity_types_transport_channel_mtls_with_client_cert_source(
+    transport_class,
+):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [
+        transports.SessionEntityTypesGrpcTransport,
+        transports.SessionEntityTypesGrpcAsyncIOTransport,
+    ],
+)
+def test_session_entity_types_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_session_entity_type_path():
+    project = "squid"
+    session = "clam"
+    entity_type = "whelk"
+
+    expected = "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}".format(
+        project=project, session=session, entity_type=entity_type,
+    )
+    actual = SessionEntityTypesClient.session_entity_type_path(
+        project, session, entity_type
+    )
+    assert expected == actual
+
+
+def test_parse_session_entity_type_path():
+    expected = {
+        "project": "octopus",
+        "session": "oyster",
+        "entity_type": "nudibranch",
+    }
+    path = SessionEntityTypesClient.session_entity_type_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_session_entity_type_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "cuttlefish"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = SessionEntityTypesClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "mussel",
+    }
+    path = SessionEntityTypesClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "winkle"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = SessionEntityTypesClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "nautilus",
+    }
+    path = SessionEntityTypesClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "scallop"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = SessionEntityTypesClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "abalone",
+    }
+    path = SessionEntityTypesClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "squid"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = SessionEntityTypesClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "clam",
+    }
+    path = SessionEntityTypesClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "whelk"
+    location = "octopus"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = SessionEntityTypesClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "oyster",
+        "location": "nudibranch",
+    }
+    path = SessionEntityTypesClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.SessionEntityTypesTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = SessionEntityTypesClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.SessionEntityTypesTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = SessionEntityTypesClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2/test_sessions.py b/tests/unit/gapic/dialogflow_v2/test_sessions.py
new file mode 100644
index 000000000..0cd66f1e6
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2/test_sessions.py
@@ -0,0 +1,1248 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2.services.sessions import SessionsAsyncClient
+from google.cloud.dialogflow_v2.services.sessions import SessionsClient
+from google.cloud.dialogflow_v2.services.sessions import transports
+from google.cloud.dialogflow_v2.types import audio_config
+from google.cloud.dialogflow_v2.types import context
+from google.cloud.dialogflow_v2.types import entity_type
+from google.cloud.dialogflow_v2.types import session
+from google.cloud.dialogflow_v2.types import session as gcd_session
+from google.cloud.dialogflow_v2.types import session_entity_type
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import struct_pb2 as struct  # type: ignore
+from google.rpc import status_pb2 as status  # type: ignore
+from google.type import latlng_pb2 as latlng  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert SessionsClient._get_default_mtls_endpoint(None) is None
+    assert SessionsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    assert (
+        SessionsClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        SessionsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        SessionsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_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_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_sessions_client_get_transport_class():
+    transport = SessionsClient.get_transport_class()
+    assert transport == transports.SessionsGrpcTransport
+
+    transport = SessionsClient.get_transport_class("grpc")
+    assert transport == transports.SessionsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionsClient, transports.SessionsGrpcTransport, "grpc"),
+        (SessionsAsyncClient, transports.SessionsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+@mock.patch.object(
+    SessionsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SessionsClient)
+)
+@mock.patch.object(
+    SessionsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionsAsyncClient),
+)
+def test_sessions_client_client_options(client_class, transport_class, transport_name):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(SessionsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(SessionsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (SessionsClient, transports.SessionsGrpcTransport, "grpc", "true"),
+        (
+            SessionsAsyncClient,
+            transports.SessionsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (SessionsClient, transports.SessionsGrpcTransport, "grpc", "false"),
+        (
+            SessionsAsyncClient,
+            transports.SessionsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    SessionsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SessionsClient)
+)
+@mock.patch.object(
+    SessionsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionsAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_sessions_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionsClient, transports.SessionsGrpcTransport, "grpc"),
+        (SessionsAsyncClient, transports.SessionsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionsClient, transports.SessionsGrpcTransport, "grpc"),
+        (SessionsAsyncClient, transports.SessionsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+def test_sessions_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_sessions_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.sessions.transports.SessionsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = SessionsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_detect_intent(
+    transport: str = "grpc", request_type=gcd_session.DetectIntentRequest
+):
+    client = SessionsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.detect_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session.DetectIntentResponse(
+            response_id="response_id_value", output_audio=b"output_audio_blob",
+        )
+
+        response = client.detect_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session.DetectIntentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_session.DetectIntentResponse)
+
+    assert response.response_id == "response_id_value"
+
+    assert response.output_audio == b"output_audio_blob"
+
+
+def test_detect_intent_from_dict():
+    test_detect_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_detect_intent_async(
+    transport: str = "grpc_asyncio", request_type=gcd_session.DetectIntentRequest
+):
+    client = SessionsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.detect_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session.DetectIntentResponse(
+                response_id="response_id_value", output_audio=b"output_audio_blob",
+            )
+        )
+
+        response = await client.detect_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session.DetectIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_session.DetectIntentResponse)
+
+    assert response.response_id == "response_id_value"
+
+    assert response.output_audio == b"output_audio_blob"
+
+
+@pytest.mark.asyncio
+async def test_detect_intent_async_from_dict():
+    await test_detect_intent_async(request_type=dict)
+
+
+def test_detect_intent_field_headers():
+    client = SessionsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session.DetectIntentRequest()
+    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:
+        call.return_value = gcd_session.DetectIntentResponse()
+
+        client.detect_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session.DetectIntentRequest()
+    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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session.DetectIntentResponse()
+        )
+
+        await client.detect_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "session=session/value",) in kw["metadata"]
+
+
+def test_detect_intent_flattened():
+    client = SessionsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.detect_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session.DetectIntentResponse()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.detect_intent(
+            session="session_value",
+            query_input=gcd_session.QueryInput(
+                audio_config=audio_config.InputAudioConfig(
+                    audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+                )
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].session == "session_value"
+
+        assert args[0].query_input == gcd_session.QueryInput(
+            audio_config=audio_config.InputAudioConfig(
+                audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+            )
+        )
+
+
+def test_detect_intent_flattened_error():
+    client = SessionsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.detect_intent(
+            gcd_session.DetectIntentRequest(),
+            session="session_value",
+            query_input=gcd_session.QueryInput(
+                audio_config=audio_config.InputAudioConfig(
+                    audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+                )
+            ),
+        )
+
+
+@pytest.mark.asyncio
+async def test_detect_intent_flattened_async():
+    client = SessionsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.detect_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session.DetectIntentResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session.DetectIntentResponse()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.detect_intent(
+            session="session_value",
+            query_input=gcd_session.QueryInput(
+                audio_config=audio_config.InputAudioConfig(
+                    audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+                )
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].session == "session_value"
+
+        assert args[0].query_input == gcd_session.QueryInput(
+            audio_config=audio_config.InputAudioConfig(
+                audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+            )
+        )
+
+
+@pytest.mark.asyncio
+async def test_detect_intent_flattened_error_async():
+    client = SessionsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.detect_intent(
+            gcd_session.DetectIntentRequest(),
+            session="session_value",
+            query_input=gcd_session.QueryInput(
+                audio_config=audio_config.InputAudioConfig(
+                    audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+                )
+            ),
+        )
+
+
+def test_streaming_detect_intent(
+    transport: str = "grpc", request_type=session.StreamingDetectIntentRequest
+):
+    client = SessionsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    requests = [request]
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.streaming_detect_intent), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = iter([session.StreamingDetectIntentResponse()])
+
+        response = client.streaming_detect_intent(iter(requests))
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert next(args[0]) == request
+
+    # Establish that the response is the type that we expect.
+    for message in response:
+        assert isinstance(message, session.StreamingDetectIntentResponse)
+
+
+def test_streaming_detect_intent_from_dict():
+    test_streaming_detect_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_streaming_detect_intent_async(
+    transport: str = "grpc_asyncio", request_type=session.StreamingDetectIntentRequest
+):
+    client = SessionsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    requests = [request]
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.streaming_detect_intent), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = mock.Mock(aio.StreamStreamCall, autospec=True)
+        call.return_value.read = mock.AsyncMock(
+            side_effect=[session.StreamingDetectIntentResponse()]
+        )
+
+        response = await client.streaming_detect_intent(iter(requests))
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert next(args[0]) == request
+
+    # Establish that the response is the type that we expect.
+    message = await response.read()
+    assert isinstance(message, session.StreamingDetectIntentResponse)
+
+
+@pytest.mark.asyncio
+async def test_streaming_detect_intent_async_from_dict():
+    await test_streaming_detect_intent_async(request_type=dict)
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.SessionsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.SessionsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.SessionsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.SessionsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = SessionsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.SessionsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.SessionsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.SessionsGrpcTransport, transports.SessionsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = SessionsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.SessionsGrpcTransport,)
+
+
+def test_sessions_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.SessionsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_sessions_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2.services.sessions.transports.SessionsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.SessionsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "detect_intent",
+        "streaming_detect_intent",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+
+def test_sessions_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2.services.sessions.transports.SessionsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.SessionsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_sessions_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2.services.sessions.transports.SessionsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.SessionsTransport()
+        adc.assert_called_once()
+
+
+def test_sessions_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        SessionsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_sessions_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.SessionsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_sessions_host_no_port():
+    client = SessionsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_sessions_host_with_port():
+    client = SessionsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_sessions_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.SessionsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_sessions_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.SessionsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.SessionsGrpcTransport, transports.SessionsGrpcAsyncIOTransport],
+)
+def test_sessions_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.SessionsGrpcTransport, transports.SessionsGrpcAsyncIOTransport],
+)
+def test_sessions_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_context_path():
+    project = "squid"
+    session = "clam"
+    context = "whelk"
+
+    expected = "projects/{project}/agent/sessions/{session}/contexts/{context}".format(
+        project=project, session=session, context=context,
+    )
+    actual = SessionsClient.context_path(project, session, context)
+    assert expected == actual
+
+
+def test_parse_context_path():
+    expected = {
+        "project": "octopus",
+        "session": "oyster",
+        "context": "nudibranch",
+    }
+    path = SessionsClient.context_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_context_path(path)
+    assert expected == actual
+
+
+def test_intent_path():
+    project = "cuttlefish"
+    intent = "mussel"
+
+    expected = "projects/{project}/agent/intents/{intent}".format(
+        project=project, intent=intent,
+    )
+    actual = SessionsClient.intent_path(project, intent)
+    assert expected == actual
+
+
+def test_parse_intent_path():
+    expected = {
+        "project": "winkle",
+        "intent": "nautilus",
+    }
+    path = SessionsClient.intent_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_intent_path(path)
+    assert expected == actual
+
+
+def test_session_path():
+    project = "scallop"
+    session = "abalone"
+
+    expected = "projects/{project}/agent/sessions/{session}".format(
+        project=project, session=session,
+    )
+    actual = SessionsClient.session_path(project, session)
+    assert expected == actual
+
+
+def test_parse_session_path():
+    expected = {
+        "project": "squid",
+        "session": "clam",
+    }
+    path = SessionsClient.session_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_session_path(path)
+    assert expected == actual
+
+
+def test_session_entity_type_path():
+    project = "whelk"
+    session = "octopus"
+    entity_type = "oyster"
+
+    expected = "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}".format(
+        project=project, session=session, entity_type=entity_type,
+    )
+    actual = SessionsClient.session_entity_type_path(project, session, entity_type)
+    assert expected == actual
+
+
+def test_parse_session_entity_type_path():
+    expected = {
+        "project": "nudibranch",
+        "session": "cuttlefish",
+        "entity_type": "mussel",
+    }
+    path = SessionsClient.session_entity_type_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_session_entity_type_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "winkle"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = SessionsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "nautilus",
+    }
+    path = SessionsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "scallop"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = SessionsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "abalone",
+    }
+    path = SessionsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "squid"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = SessionsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "clam",
+    }
+    path = SessionsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "whelk"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = SessionsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "octopus",
+    }
+    path = SessionsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "oyster"
+    location = "nudibranch"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = SessionsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "cuttlefish",
+        "location": "mussel",
+    }
+    path = SessionsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.SessionsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = SessionsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.SessionsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = SessionsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2beta1/__init__.py b/tests/unit/gapic/dialogflow_v2beta1/__init__.py
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2beta1/__init__.py
@@ -0,0 +1 @@
+
diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_agents.py b/tests/unit/gapic/dialogflow_v2beta1/test_agents.py
new file mode 100644
index 000000000..d5ac6370a
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2beta1/test_agents.py
@@ -0,0 +1,2607 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import future
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.api_core import operation_async  # type: ignore
+from google.api_core import operations_v1
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2beta1.services.agents import AgentsAsyncClient
+from google.cloud.dialogflow_v2beta1.services.agents import AgentsClient
+from google.cloud.dialogflow_v2beta1.services.agents import pagers
+from google.cloud.dialogflow_v2beta1.services.agents import transports
+from google.cloud.dialogflow_v2beta1.types import agent
+from google.cloud.dialogflow_v2beta1.types import agent as gcd_agent
+from google.cloud.dialogflow_v2beta1.types import validation_result
+from google.longrunning import operations_pb2
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import struct_pb2 as struct  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert AgentsClient._get_default_mtls_endpoint(None) is None
+    assert AgentsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    assert (
+        AgentsClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint
+    )
+    assert (
+        AgentsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        AgentsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_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_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_agents_client_get_transport_class():
+    transport = AgentsClient.get_transport_class()
+    assert transport == transports.AgentsGrpcTransport
+
+    transport = AgentsClient.get_transport_class("grpc")
+    assert transport == transports.AgentsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (AgentsClient, transports.AgentsGrpcTransport, "grpc"),
+        (AgentsAsyncClient, transports.AgentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+@mock.patch.object(
+    AgentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AgentsClient)
+)
+@mock.patch.object(
+    AgentsAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AgentsAsyncClient)
+)
+def test_agents_client_client_options(client_class, transport_class, transport_name):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(AgentsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(AgentsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (AgentsClient, transports.AgentsGrpcTransport, "grpc", "true"),
+        (
+            AgentsAsyncClient,
+            transports.AgentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (AgentsClient, transports.AgentsGrpcTransport, "grpc", "false"),
+        (
+            AgentsAsyncClient,
+            transports.AgentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    AgentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AgentsClient)
+)
+@mock.patch.object(
+    AgentsAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AgentsAsyncClient)
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_agents_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (AgentsClient, transports.AgentsGrpcTransport, "grpc"),
+        (AgentsAsyncClient, transports.AgentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (AgentsClient, transports.AgentsGrpcTransport, "grpc"),
+        (AgentsAsyncClient, transports.AgentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+def test_agents_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_agents_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.agents.transports.AgentsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = AgentsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_get_agent(transport: str = "grpc", request_type=agent.GetAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = agent.Agent(
+            parent="parent_value",
+            display_name="display_name_value",
+            default_language_code="default_language_code_value",
+            supported_language_codes=["supported_language_codes_value"],
+            time_zone="time_zone_value",
+            description="description_value",
+            avatar_uri="avatar_uri_value",
+            enable_logging=True,
+            match_mode=agent.Agent.MatchMode.MATCH_MODE_HYBRID,
+            classification_threshold=0.2552,
+            api_version=agent.Agent.ApiVersion.API_VERSION_V1,
+            tier=agent.Agent.Tier.TIER_STANDARD,
+        )
+
+        response = client.get_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.GetAgentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, agent.Agent)
+
+    assert response.parent == "parent_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.default_language_code == "default_language_code_value"
+
+    assert response.supported_language_codes == ["supported_language_codes_value"]
+
+    assert response.time_zone == "time_zone_value"
+
+    assert response.description == "description_value"
+
+    assert response.avatar_uri == "avatar_uri_value"
+
+    assert response.enable_logging is True
+
+    assert response.match_mode == agent.Agent.MatchMode.MATCH_MODE_HYBRID
+
+    assert math.isclose(response.classification_threshold, 0.2552, rel_tol=1e-6)
+
+    assert response.api_version == agent.Agent.ApiVersion.API_VERSION_V1
+
+    assert response.tier == agent.Agent.Tier.TIER_STANDARD
+
+
+def test_get_agent_from_dict():
+    test_get_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.GetAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            agent.Agent(
+                parent="parent_value",
+                display_name="display_name_value",
+                default_language_code="default_language_code_value",
+                supported_language_codes=["supported_language_codes_value"],
+                time_zone="time_zone_value",
+                description="description_value",
+                avatar_uri="avatar_uri_value",
+                enable_logging=True,
+                match_mode=agent.Agent.MatchMode.MATCH_MODE_HYBRID,
+                classification_threshold=0.2552,
+                api_version=agent.Agent.ApiVersion.API_VERSION_V1,
+                tier=agent.Agent.Tier.TIER_STANDARD,
+            )
+        )
+
+        response = await client.get_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.GetAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, agent.Agent)
+
+    assert response.parent == "parent_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.default_language_code == "default_language_code_value"
+
+    assert response.supported_language_codes == ["supported_language_codes_value"]
+
+    assert response.time_zone == "time_zone_value"
+
+    assert response.description == "description_value"
+
+    assert response.avatar_uri == "avatar_uri_value"
+
+    assert response.enable_logging is True
+
+    assert response.match_mode == agent.Agent.MatchMode.MATCH_MODE_HYBRID
+
+    assert math.isclose(response.classification_threshold, 0.2552, rel_tol=1e-6)
+
+    assert response.api_version == agent.Agent.ApiVersion.API_VERSION_V1
+
+    assert response.tier == agent.Agent.Tier.TIER_STANDARD
+
+
+@pytest.mark.asyncio
+async def test_get_agent_async_from_dict():
+    await test_get_agent_async(request_type=dict)
+
+
+def test_get_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = agent.Agent()
+
+        client.get_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_get_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(agent.Agent())
+
+        await client.get_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_get_agent_flattened():
+    client = AgentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_get_agent_flattened_error():
+    client = AgentsClient(credentials=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(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_agent_flattened_async():
+    client = AgentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = agent.Agent()
+
+        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(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_get_agent_flattened_error_async():
+    client = AgentsAsyncClient(credentials=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(), parent="parent_value",
+        )
+
+
+def test_set_agent(transport: str = "grpc", request_type=gcd_agent.SetAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_agent.Agent(
+            parent="parent_value",
+            display_name="display_name_value",
+            default_language_code="default_language_code_value",
+            supported_language_codes=["supported_language_codes_value"],
+            time_zone="time_zone_value",
+            description="description_value",
+            avatar_uri="avatar_uri_value",
+            enable_logging=True,
+            match_mode=gcd_agent.Agent.MatchMode.MATCH_MODE_HYBRID,
+            classification_threshold=0.2552,
+            api_version=gcd_agent.Agent.ApiVersion.API_VERSION_V1,
+            tier=gcd_agent.Agent.Tier.TIER_STANDARD,
+        )
+
+        response = client.set_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_agent.SetAgentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_agent.Agent)
+
+    assert response.parent == "parent_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.default_language_code == "default_language_code_value"
+
+    assert response.supported_language_codes == ["supported_language_codes_value"]
+
+    assert response.time_zone == "time_zone_value"
+
+    assert response.description == "description_value"
+
+    assert response.avatar_uri == "avatar_uri_value"
+
+    assert response.enable_logging is True
+
+    assert response.match_mode == gcd_agent.Agent.MatchMode.MATCH_MODE_HYBRID
+
+    assert math.isclose(response.classification_threshold, 0.2552, rel_tol=1e-6)
+
+    assert response.api_version == gcd_agent.Agent.ApiVersion.API_VERSION_V1
+
+    assert response.tier == gcd_agent.Agent.Tier.TIER_STANDARD
+
+
+def test_set_agent_from_dict():
+    test_set_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_set_agent_async(
+    transport: str = "grpc_asyncio", request_type=gcd_agent.SetAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_agent.Agent(
+                parent="parent_value",
+                display_name="display_name_value",
+                default_language_code="default_language_code_value",
+                supported_language_codes=["supported_language_codes_value"],
+                time_zone="time_zone_value",
+                description="description_value",
+                avatar_uri="avatar_uri_value",
+                enable_logging=True,
+                match_mode=gcd_agent.Agent.MatchMode.MATCH_MODE_HYBRID,
+                classification_threshold=0.2552,
+                api_version=gcd_agent.Agent.ApiVersion.API_VERSION_V1,
+                tier=gcd_agent.Agent.Tier.TIER_STANDARD,
+            )
+        )
+
+        response = await client.set_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_agent.SetAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_agent.Agent)
+
+    assert response.parent == "parent_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.default_language_code == "default_language_code_value"
+
+    assert response.supported_language_codes == ["supported_language_codes_value"]
+
+    assert response.time_zone == "time_zone_value"
+
+    assert response.description == "description_value"
+
+    assert response.avatar_uri == "avatar_uri_value"
+
+    assert response.enable_logging is True
+
+    assert response.match_mode == gcd_agent.Agent.MatchMode.MATCH_MODE_HYBRID
+
+    assert math.isclose(response.classification_threshold, 0.2552, rel_tol=1e-6)
+
+    assert response.api_version == gcd_agent.Agent.ApiVersion.API_VERSION_V1
+
+    assert response.tier == gcd_agent.Agent.Tier.TIER_STANDARD
+
+
+@pytest.mark.asyncio
+async def test_set_agent_async_from_dict():
+    await test_set_agent_async(request_type=dict)
+
+
+def test_set_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_agent.SetAgentRequest()
+    request.agent.parent = "agent.parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        call.return_value = gcd_agent.Agent()
+
+        client.set_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "agent.parent=agent.parent/value",) in kw[
+        "metadata"
+    ]
+
+
+@pytest.mark.asyncio
+async def test_set_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_agent.SetAgentRequest()
+    request.agent.parent = "agent.parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_agent.Agent())
+
+        await client.set_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "agent.parent=agent.parent/value",) in kw[
+        "metadata"
+    ]
+
+
+def test_set_agent_flattened():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_agent.Agent()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.set_agent(agent=gcd_agent.Agent(parent="parent_value"),)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].agent == gcd_agent.Agent(parent="parent_value")
+
+
+def test_set_agent_flattened_error():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.set_agent(
+            gcd_agent.SetAgentRequest(), agent=gcd_agent.Agent(parent="parent_value"),
+        )
+
+
+@pytest.mark.asyncio
+async def test_set_agent_flattened_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.set_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_agent.Agent()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_agent.Agent())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.set_agent(agent=gcd_agent.Agent(parent="parent_value"),)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].agent == gcd_agent.Agent(parent="parent_value")
+
+
+@pytest.mark.asyncio
+async def test_set_agent_flattened_error_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.set_agent(
+            gcd_agent.SetAgentRequest(), agent=gcd_agent.Agent(parent="parent_value"),
+        )
+
+
+def test_delete_agent(transport: str = "grpc", request_type=agent.DeleteAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.DeleteAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_agent_from_dict():
+    test_delete_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.DeleteAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.DeleteAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_agent_async_from_dict():
+    await test_delete_agent_async(request_type=dict)
+
+
+def test_delete_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = None
+
+        client.delete_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_delete_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_delete_agent_flattened():
+    client = AgentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_delete_agent_flattened_error():
+    client = AgentsClient(credentials=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(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_agent_flattened_async():
+    client = AgentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_agent_flattened_error_async():
+    client = AgentsAsyncClient(credentials=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(), parent="parent_value",
+        )
+
+
+def test_search_agents(transport: str = "grpc", request_type=agent.SearchAgentsRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = agent.SearchAgentsResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.search_agents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.SearchAgentsRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.SearchAgentsPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_search_agents_from_dict():
+    test_search_agents(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_search_agents_async(
+    transport: str = "grpc_asyncio", request_type=agent.SearchAgentsRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            agent.SearchAgentsResponse(next_page_token="next_page_token_value",)
+        )
+
+        response = await client.search_agents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.SearchAgentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.SearchAgentsAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_search_agents_async_from_dict():
+    await test_search_agents_async(request_type=dict)
+
+
+def test_search_agents_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.SearchAgentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        call.return_value = agent.SearchAgentsResponse()
+
+        client.search_agents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_search_agents_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.SearchAgentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            agent.SearchAgentsResponse()
+        )
+
+        await client.search_agents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_search_agents_flattened():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = agent.SearchAgentsResponse()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.search_agents(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_search_agents_flattened_error():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.search_agents(
+            agent.SearchAgentsRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_search_agents_flattened_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = agent.SearchAgentsResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            agent.SearchAgentsResponse()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.search_agents(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_search_agents_flattened_error_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.search_agents(
+            agent.SearchAgentsRequest(), parent="parent_value",
+        )
+
+
+def test_search_agents_pager():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            agent.SearchAgentsResponse(
+                agents=[agent.Agent(), agent.Agent(), agent.Agent(),],
+                next_page_token="abc",
+            ),
+            agent.SearchAgentsResponse(agents=[], next_page_token="def",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(), agent.Agent(),],),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.search_agents(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, agent.Agent) for i in results)
+
+
+def test_search_agents_pages():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.search_agents), "__call__") as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            agent.SearchAgentsResponse(
+                agents=[agent.Agent(), agent.Agent(), agent.Agent(),],
+                next_page_token="abc",
+            ),
+            agent.SearchAgentsResponse(agents=[], next_page_token="def",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(), agent.Agent(),],),
+            RuntimeError,
+        )
+        pages = list(client.search_agents(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_search_agents_async_pager():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.search_agents), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            agent.SearchAgentsResponse(
+                agents=[agent.Agent(), agent.Agent(), agent.Agent(),],
+                next_page_token="abc",
+            ),
+            agent.SearchAgentsResponse(agents=[], next_page_token="def",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(), agent.Agent(),],),
+            RuntimeError,
+        )
+        async_pager = await client.search_agents(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, agent.Agent) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_search_agents_async_pages():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.search_agents), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            agent.SearchAgentsResponse(
+                agents=[agent.Agent(), agent.Agent(), agent.Agent(),],
+                next_page_token="abc",
+            ),
+            agent.SearchAgentsResponse(agents=[], next_page_token="def",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",),
+            agent.SearchAgentsResponse(agents=[agent.Agent(), agent.Agent(),],),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.search_agents(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_train_agent(transport: str = "grpc", request_type=agent.TrainAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.train_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.TrainAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_train_agent_from_dict():
+    test_train_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_train_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.TrainAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.train_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.TrainAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_train_agent_async_from_dict():
+    await test_train_agent_async(request_type=dict)
+
+
+def test_train_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.TrainAgentRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.train_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_train_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.TrainAgentRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.train_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_train_agent_flattened():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        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_agent(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_train_agent_flattened_error():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.train_agent(
+            agent.TrainAgentRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_train_agent_flattened_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.train_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.train_agent(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_train_agent_flattened_error_async():
+    client = AgentsAsyncClient(credentials=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_agent(
+            agent.TrainAgentRequest(), parent="parent_value",
+        )
+
+
+def test_export_agent(transport: str = "grpc", request_type=agent.ExportAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.export_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.export_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.ExportAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_export_agent_from_dict():
+    test_export_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_export_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.ExportAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.export_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.export_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.ExportAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_export_agent_async_from_dict():
+    await test_export_agent_async(request_type=dict)
+
+
+def test_export_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.export_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_export_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.export_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_export_agent_flattened():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.export_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        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.export_agent(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_export_agent_flattened_error():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.export_agent(
+            agent.ExportAgentRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_export_agent_flattened_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.export_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.export_agent(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_export_agent_flattened_error_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.export_agent(
+            agent.ExportAgentRequest(), parent="parent_value",
+        )
+
+
+def test_import_agent(transport: str = "grpc", request_type=agent.ImportAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.import_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.import_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.ImportAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_import_agent_from_dict():
+    test_import_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_import_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.ImportAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.import_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.import_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.ImportAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_import_agent_async_from_dict():
+    await test_import_agent_async(request_type=dict)
+
+
+def test_import_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.ImportAgentRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.import_agent), "__call__") as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.import_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_import_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.ImportAgentRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.import_agent), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.import_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_restore_agent(transport: str = "grpc", request_type=agent.RestoreAgentRequest):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.restore_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.restore_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.RestoreAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_restore_agent_from_dict():
+    test_restore_agent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_restore_agent_async(
+    transport: str = "grpc_asyncio", request_type=agent.RestoreAgentRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.restore_agent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.restore_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.RestoreAgentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_restore_agent_async_from_dict():
+    await test_restore_agent_async(request_type=dict)
+
+
+def test_restore_agent_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.restore_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_restore_agent_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.parent = "parent/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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.restore_agent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_get_validation_result(
+    transport: str = "grpc", request_type=agent.GetValidationResultRequest
+):
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_validation_result), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = validation_result.ValidationResult()
+
+        response = client.get_validation_result(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.GetValidationResultRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, validation_result.ValidationResult)
+
+
+def test_get_validation_result_from_dict():
+    test_get_validation_result(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_validation_result_async(
+    transport: str = "grpc_asyncio", request_type=agent.GetValidationResultRequest
+):
+    client = AgentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_validation_result), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            validation_result.ValidationResult()
+        )
+
+        response = await client.get_validation_result(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == agent.GetValidationResultRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, validation_result.ValidationResult)
+
+
+@pytest.mark.asyncio
+async def test_get_validation_result_async_from_dict():
+    await test_get_validation_result_async(request_type=dict)
+
+
+def test_get_validation_result_field_headers():
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.GetValidationResultRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_validation_result), "__call__"
+    ) as call:
+        call.return_value = validation_result.ValidationResult()
+
+        client.get_validation_result(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_get_validation_result_field_headers_async():
+    client = AgentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.GetValidationResultRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_validation_result), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            validation_result.ValidationResult()
+        )
+
+        await client.get_validation_result(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.AgentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = AgentsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.AgentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = AgentsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.AgentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = AgentsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.AgentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = AgentsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.AgentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.AgentsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.AgentsGrpcTransport, transports.AgentsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = AgentsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.AgentsGrpcTransport,)
+
+
+def test_agents_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.AgentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_agents_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.agents.transports.AgentsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.AgentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "get_agent",
+        "set_agent",
+        "delete_agent",
+        "search_agents",
+        "train_agent",
+        "export_agent",
+        "import_agent",
+        "restore_agent",
+        "get_validation_result",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+    # Additionally, the LRO client (a property) should
+    # also raise NotImplementedError
+    with pytest.raises(NotImplementedError):
+        transport.operations_client
+
+
+def test_agents_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.agents.transports.AgentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.AgentsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_agents_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.agents.transports.AgentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.AgentsTransport()
+        adc.assert_called_once()
+
+
+def test_agents_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        AgentsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_agents_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.AgentsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_agents_host_no_port():
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_agents_host_with_port():
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_agents_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.AgentsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_agents_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.AgentsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.AgentsGrpcTransport, transports.AgentsGrpcAsyncIOTransport],
+)
+def test_agents_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.AgentsGrpcTransport, transports.AgentsGrpcAsyncIOTransport],
+)
+def test_agents_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_agents_grpc_lro_client():
+    client = AgentsClient(
+        credentials=credentials.AnonymousCredentials(), transport="grpc",
+    )
+    transport = client.transport
+
+    # Ensure that we have a api-core operations client.
+    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
+
+
+def test_agents_grpc_lro_async_client():
+    client = AgentsAsyncClient(
+        credentials=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,)
+
+    # Ensure that subsequent calls to the property send the exact same object.
+    assert transport.operations_client is transport.operations_client
+
+
+def test_agent_path():
+    project = "squid"
+
+    expected = "projects/{project}/agent".format(project=project,)
+    actual = AgentsClient.agent_path(project)
+    assert expected == actual
+
+
+def test_parse_agent_path():
+    expected = {
+        "project": "clam",
+    }
+    path = AgentsClient.agent_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_agent_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "whelk"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = AgentsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "octopus",
+    }
+    path = AgentsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "oyster"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = AgentsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "nudibranch",
+    }
+    path = AgentsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "cuttlefish"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = AgentsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "mussel",
+    }
+    path = AgentsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "winkle"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = AgentsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "nautilus",
+    }
+    path = AgentsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "scallop"
+    location = "abalone"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = AgentsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "squid",
+        "location": "clam",
+    }
+    path = AgentsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = AgentsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.AgentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = AgentsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.AgentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = AgentsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_contexts.py b/tests/unit/gapic/dialogflow_v2beta1/test_contexts.py
new file mode 100644
index 000000000..19aacf8a8
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2beta1/test_contexts.py
@@ -0,0 +1,2148 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2beta1.services.contexts import ContextsAsyncClient
+from google.cloud.dialogflow_v2beta1.services.contexts import ContextsClient
+from google.cloud.dialogflow_v2beta1.services.contexts import pagers
+from google.cloud.dialogflow_v2beta1.services.contexts import transports
+from google.cloud.dialogflow_v2beta1.types import context
+from google.cloud.dialogflow_v2beta1.types import context as gcd_context
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import struct_pb2 as struct  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert ContextsClient._get_default_mtls_endpoint(None) is None
+    assert ContextsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    assert (
+        ContextsClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        ContextsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        ContextsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert ContextsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi
+
+
+@pytest.mark.parametrize("client_class", [ContextsClient, ContextsAsyncClient])
+def test_contexts_client_from_service_account_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_contexts_client_get_transport_class():
+    transport = ContextsClient.get_transport_class()
+    assert transport == transports.ContextsGrpcTransport
+
+    transport = ContextsClient.get_transport_class("grpc")
+    assert transport == transports.ContextsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (ContextsClient, transports.ContextsGrpcTransport, "grpc"),
+        (ContextsAsyncClient, transports.ContextsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+@mock.patch.object(
+    ContextsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ContextsClient)
+)
+@mock.patch.object(
+    ContextsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(ContextsAsyncClient),
+)
+def test_contexts_client_client_options(client_class, transport_class, transport_name):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(ContextsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(ContextsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (ContextsClient, transports.ContextsGrpcTransport, "grpc", "true"),
+        (
+            ContextsAsyncClient,
+            transports.ContextsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (ContextsClient, transports.ContextsGrpcTransport, "grpc", "false"),
+        (
+            ContextsAsyncClient,
+            transports.ContextsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    ContextsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ContextsClient)
+)
+@mock.patch.object(
+    ContextsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(ContextsAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_contexts_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (ContextsClient, transports.ContextsGrpcTransport, "grpc"),
+        (ContextsAsyncClient, transports.ContextsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+def test_contexts_client_client_options_scopes(
+    client_class, transport_class, transport_name
+):
+    # Check the case scopes are provided.
+    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)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (ContextsClient, transports.ContextsGrpcTransport, "grpc"),
+        (ContextsAsyncClient, transports.ContextsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+def test_contexts_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_contexts_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.contexts.transports.ContextsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = ContextsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_contexts(
+    transport: str = "grpc", request_type=context.ListContextsRequest
+):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.ListContextsResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.ListContextsRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListContextsPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_contexts_from_dict():
+    test_list_contexts(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_async(
+    transport: str = "grpc_asyncio", request_type=context.ListContextsRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            context.ListContextsResponse(next_page_token="next_page_token_value",)
+        )
+
+        response = await client.list_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.ListContextsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListContextsAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_async_from_dict():
+    await test_list_contexts_async(request_type=dict)
+
+
+def test_list_contexts_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.ListContextsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        call.return_value = context.ListContextsResponse()
+
+        client.list_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.ListContextsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            context.ListContextsResponse()
+        )
+
+        await client.list_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_contexts_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.ListContextsResponse()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.list_contexts(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_list_contexts_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.list_contexts(
+            context.ListContextsRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.ListContextsResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            context.ListContextsResponse()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.list_contexts(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_flattened_error_async():
+    client = ContextsAsyncClient(credentials=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_contexts(
+            context.ListContextsRequest(), parent="parent_value",
+        )
+
+
+def test_list_contexts_pager():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(), context.Context(),],
+                next_page_token="abc",
+            ),
+            context.ListContextsResponse(contexts=[], next_page_token="def",),
+            context.ListContextsResponse(
+                contexts=[context.Context(),], next_page_token="ghi",
+            ),
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(),],
+            ),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_contexts(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, context.Context) for i in results)
+
+
+def test_list_contexts_pages():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_contexts), "__call__") as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(), context.Context(),],
+                next_page_token="abc",
+            ),
+            context.ListContextsResponse(contexts=[], next_page_token="def",),
+            context.ListContextsResponse(
+                contexts=[context.Context(),], next_page_token="ghi",
+            ),
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(),],
+            ),
+            RuntimeError,
+        )
+        pages = list(client.list_contexts(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_async_pager():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_contexts), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(), context.Context(),],
+                next_page_token="abc",
+            ),
+            context.ListContextsResponse(contexts=[], next_page_token="def",),
+            context.ListContextsResponse(
+                contexts=[context.Context(),], next_page_token="ghi",
+            ),
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(),],
+            ),
+            RuntimeError,
+        )
+        async_pager = await client.list_contexts(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, context.Context) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_list_contexts_async_pages():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_contexts), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(), context.Context(),],
+                next_page_token="abc",
+            ),
+            context.ListContextsResponse(contexts=[], next_page_token="def",),
+            context.ListContextsResponse(
+                contexts=[context.Context(),], next_page_token="ghi",
+            ),
+            context.ListContextsResponse(
+                contexts=[context.Context(), context.Context(),],
+            ),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_contexts(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_get_context(transport: str = "grpc", request_type=context.GetContextRequest):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.Context(name="name_value", lifespan_count=1498,)
+
+        response = client.get_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.GetContextRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+def test_get_context_from_dict():
+    test_get_context(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_context_async(
+    transport: str = "grpc_asyncio", request_type=context.GetContextRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            context.Context(name="name_value", lifespan_count=1498,)
+        )
+
+        response = await client.get_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.GetContextRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+@pytest.mark.asyncio
+async def test_get_context_async_from_dict():
+    await test_get_context_async(request_type=dict)
+
+
+def test_get_context_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.GetContextRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        call.return_value = context.Context()
+
+        client.get_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_get_context_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.GetContextRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(context.Context())
+
+        await client.get_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_get_context_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.Context()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.get_context(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_get_context_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.get_context(
+            context.GetContextRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_context_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = context.Context()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(context.Context())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.get_context(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_get_context_flattened_error_async():
+    client = ContextsAsyncClient(credentials=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_context(
+            context.GetContextRequest(), name="name_value",
+        )
+
+
+def test_create_context(
+    transport: str = "grpc", request_type=gcd_context.CreateContextRequest
+):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context(name="name_value", lifespan_count=1498,)
+
+        response = client.create_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_context.CreateContextRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+def test_create_context_from_dict():
+    test_create_context(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_create_context_async(
+    transport: str = "grpc_asyncio", request_type=gcd_context.CreateContextRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_context.Context(name="name_value", lifespan_count=1498,)
+        )
+
+        response = await client.create_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_context.CreateContextRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+@pytest.mark.asyncio
+async def test_create_context_async_from_dict():
+    await test_create_context_async(request_type=dict)
+
+
+def test_create_context_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_context.CreateContextRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        call.return_value = gcd_context.Context()
+
+        client.create_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_create_context_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_context.CreateContextRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_context.Context())
+
+        await client.create_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_create_context_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.create_context(
+            parent="parent_value", context=gcd_context.Context(name="name_value"),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].context == gcd_context.Context(name="name_value")
+
+
+def test_create_context_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.create_context(
+            gcd_context.CreateContextRequest(),
+            parent="parent_value",
+            context=gcd_context.Context(name="name_value"),
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_context_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_context.Context())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.create_context(
+            parent="parent_value", context=gcd_context.Context(name="name_value"),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].context == gcd_context.Context(name="name_value")
+
+
+@pytest.mark.asyncio
+async def test_create_context_flattened_error_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.create_context(
+            gcd_context.CreateContextRequest(),
+            parent="parent_value",
+            context=gcd_context.Context(name="name_value"),
+        )
+
+
+def test_update_context(
+    transport: str = "grpc", request_type=gcd_context.UpdateContextRequest
+):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context(name="name_value", lifespan_count=1498,)
+
+        response = client.update_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_context.UpdateContextRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+def test_update_context_from_dict():
+    test_update_context(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_update_context_async(
+    transport: str = "grpc_asyncio", request_type=gcd_context.UpdateContextRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_context.Context(name="name_value", lifespan_count=1498,)
+        )
+
+        response = await client.update_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_context.UpdateContextRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_context.Context)
+
+    assert response.name == "name_value"
+
+    assert response.lifespan_count == 1498
+
+
+@pytest.mark.asyncio
+async def test_update_context_async_from_dict():
+    await test_update_context_async(request_type=dict)
+
+
+def test_update_context_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_context.UpdateContextRequest()
+    request.context.name = "context.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        call.return_value = gcd_context.Context()
+
+        client.update_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "context.name=context.name/value",) in kw[
+        "metadata"
+    ]
+
+
+@pytest.mark.asyncio
+async def test_update_context_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_context.UpdateContextRequest()
+    request.context.name = "context.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_context.Context())
+
+        await client.update_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "context.name=context.name/value",) in kw[
+        "metadata"
+    ]
+
+
+def test_update_context_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.update_context(
+            context=gcd_context.Context(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].context == gcd_context.Context(name="name_value")
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+def test_update_context_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.update_context(
+            gcd_context.UpdateContextRequest(),
+            context=gcd_context.Context(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+@pytest.mark.asyncio
+async def test_update_context_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_context.Context()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_context.Context())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.update_context(
+            context=gcd_context.Context(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].context == gcd_context.Context(name="name_value")
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+@pytest.mark.asyncio
+async def test_update_context_flattened_error_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.update_context(
+            gcd_context.UpdateContextRequest(),
+            context=gcd_context.Context(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+def test_delete_context(
+    transport: str = "grpc", request_type=context.DeleteContextRequest
+):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.DeleteContextRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_context_from_dict():
+    test_delete_context(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_context_async(
+    transport: str = "grpc_asyncio", request_type=context.DeleteContextRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.DeleteContextRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_context_async_from_dict():
+    await test_delete_context_async(request_type=dict)
+
+
+def test_delete_context_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.DeleteContextRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        call.return_value = None
+
+        client.delete_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_delete_context_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.DeleteContextRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_context(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_delete_context_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.delete_context(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_delete_context_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.delete_context(
+            context.DeleteContextRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_context_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_context), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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_context(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_context_flattened_error_async():
+    client = ContextsAsyncClient(credentials=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_context(
+            context.DeleteContextRequest(), name="name_value",
+        )
+
+
+def test_delete_all_contexts(
+    transport: str = "grpc", request_type=context.DeleteAllContextsRequest
+):
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_all_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.DeleteAllContextsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_all_contexts_from_dict():
+    test_delete_all_contexts(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_all_contexts_async(
+    transport: str = "grpc_asyncio", request_type=context.DeleteAllContextsRequest
+):
+    client = ContextsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_all_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == context.DeleteAllContextsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_all_contexts_async_from_dict():
+    await test_delete_all_contexts_async(request_type=dict)
+
+
+def test_delete_all_contexts_field_headers():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.DeleteAllContextsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        call.return_value = None
+
+        client.delete_all_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_delete_all_contexts_field_headers_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = context.DeleteAllContextsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_all_contexts(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_delete_all_contexts_flattened():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.delete_all_contexts(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_delete_all_contexts_flattened_error():
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.delete_all_contexts(
+            context.DeleteAllContextsRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_all_contexts_flattened_async():
+    client = ContextsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_all_contexts), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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_all_contexts(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_all_contexts_flattened_error_async():
+    client = ContextsAsyncClient(credentials=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_all_contexts(
+            context.DeleteAllContextsRequest(), parent="parent_value",
+        )
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.ContextsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = ContextsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.ContextsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = ContextsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.ContextsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = ContextsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.ContextsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = ContextsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.ContextsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.ContextsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.ContextsGrpcTransport, transports.ContextsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = ContextsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.ContextsGrpcTransport,)
+
+
+def test_contexts_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.ContextsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_contexts_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.contexts.transports.ContextsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.ContextsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "list_contexts",
+        "get_context",
+        "create_context",
+        "update_context",
+        "delete_context",
+        "delete_all_contexts",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+
+def test_contexts_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.contexts.transports.ContextsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.ContextsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_contexts_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.contexts.transports.ContextsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.ContextsTransport()
+        adc.assert_called_once()
+
+
+def test_contexts_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        ContextsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_contexts_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.ContextsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_contexts_host_no_port():
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_contexts_host_with_port():
+    client = ContextsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_contexts_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.ContextsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_contexts_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.ContextsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.ContextsGrpcTransport, transports.ContextsGrpcAsyncIOTransport],
+)
+def test_contexts_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.ContextsGrpcTransport, transports.ContextsGrpcAsyncIOTransport],
+)
+def test_contexts_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_context_path():
+    project = "squid"
+    session = "clam"
+    context = "whelk"
+
+    expected = "projects/{project}/agent/sessions/{session}/contexts/{context}".format(
+        project=project, session=session, context=context,
+    )
+    actual = ContextsClient.context_path(project, session, context)
+    assert expected == actual
+
+
+def test_parse_context_path():
+    expected = {
+        "project": "octopus",
+        "session": "oyster",
+        "context": "nudibranch",
+    }
+    path = ContextsClient.context_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_context_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "cuttlefish"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = ContextsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "mussel",
+    }
+    path = ContextsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "winkle"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = ContextsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "nautilus",
+    }
+    path = ContextsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "scallop"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = ContextsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "abalone",
+    }
+    path = ContextsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "squid"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = ContextsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "clam",
+    }
+    path = ContextsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "whelk"
+    location = "octopus"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = ContextsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "oyster",
+        "location": "nudibranch",
+    }
+    path = ContextsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = ContextsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.ContextsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = ContextsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.ContextsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = ContextsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_documents.py b/tests/unit/gapic/dialogflow_v2beta1/test_documents.py
new file mode 100644
index 000000000..8784c6dd6
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2beta1/test_documents.py
@@ -0,0 +1,2243 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import future
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.api_core import operation_async  # type: ignore
+from google.api_core import operations_v1
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2beta1.services.documents import DocumentsAsyncClient
+from google.cloud.dialogflow_v2beta1.services.documents import DocumentsClient
+from google.cloud.dialogflow_v2beta1.services.documents import pagers
+from google.cloud.dialogflow_v2beta1.services.documents import transports
+from google.cloud.dialogflow_v2beta1.types import document
+from google.cloud.dialogflow_v2beta1.types import document as gcd_document
+from google.cloud.dialogflow_v2beta1.types import gcs
+from google.longrunning import operations_pb2
+from google.oauth2 import service_account
+from google.protobuf import any_pb2 as gp_any  # type: ignore
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import timestamp_pb2 as timestamp  # type: ignore
+from google.rpc import status_pb2 as status  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert DocumentsClient._get_default_mtls_endpoint(None) is None
+    assert DocumentsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    assert (
+        DocumentsClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        DocumentsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        DocumentsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert DocumentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi
+
+
+@pytest.mark.parametrize("client_class", [DocumentsClient, DocumentsAsyncClient])
+def test_documents_client_from_service_account_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_documents_client_get_transport_class():
+    transport = DocumentsClient.get_transport_class()
+    assert transport == transports.DocumentsGrpcTransport
+
+    transport = DocumentsClient.get_transport_class("grpc")
+    assert transport == transports.DocumentsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (DocumentsClient, transports.DocumentsGrpcTransport, "grpc"),
+        (
+            DocumentsAsyncClient,
+            transports.DocumentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+@mock.patch.object(
+    DocumentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DocumentsClient)
+)
+@mock.patch.object(
+    DocumentsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(DocumentsAsyncClient),
+)
+def test_documents_client_client_options(client_class, transport_class, transport_name):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(DocumentsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(DocumentsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (DocumentsClient, transports.DocumentsGrpcTransport, "grpc", "true"),
+        (
+            DocumentsAsyncClient,
+            transports.DocumentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (DocumentsClient, transports.DocumentsGrpcTransport, "grpc", "false"),
+        (
+            DocumentsAsyncClient,
+            transports.DocumentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    DocumentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DocumentsClient)
+)
+@mock.patch.object(
+    DocumentsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(DocumentsAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_documents_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (DocumentsClient, transports.DocumentsGrpcTransport, "grpc"),
+        (
+            DocumentsAsyncClient,
+            transports.DocumentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+def test_documents_client_client_options_scopes(
+    client_class, transport_class, transport_name
+):
+    # Check the case scopes are provided.
+    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)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (DocumentsClient, transports.DocumentsGrpcTransport, "grpc"),
+        (
+            DocumentsAsyncClient,
+            transports.DocumentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+def test_documents_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_documents_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.documents.transports.DocumentsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = DocumentsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_documents(
+    transport: str = "grpc", request_type=document.ListDocumentsRequest
+):
+    client = DocumentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_documents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = document.ListDocumentsResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_documents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == document.ListDocumentsRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListDocumentsPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_documents_from_dict():
+    test_list_documents(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_documents_async(
+    transport: str = "grpc_asyncio", request_type=document.ListDocumentsRequest
+):
+    client = DocumentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_documents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            document.ListDocumentsResponse(next_page_token="next_page_token_value",)
+        )
+
+        response = await client.list_documents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == document.ListDocumentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListDocumentsAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_documents_async_from_dict():
+    await test_list_documents_async(request_type=dict)
+
+
+def test_list_documents_field_headers():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = document.ListDocumentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_documents), "__call__") as call:
+        call.return_value = document.ListDocumentsResponse()
+
+        client.list_documents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_list_documents_field_headers_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = document.ListDocumentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_documents), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            document.ListDocumentsResponse()
+        )
+
+        await client.list_documents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_documents_flattened():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_documents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = document.ListDocumentsResponse()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.list_documents(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_list_documents_flattened_error():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.list_documents(
+            document.ListDocumentsRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_documents_flattened_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_documents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = document.ListDocumentsResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            document.ListDocumentsResponse()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.list_documents(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_list_documents_flattened_error_async():
+    client = DocumentsAsyncClient(credentials=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_documents(
+            document.ListDocumentsRequest(), parent="parent_value",
+        )
+
+
+def test_list_documents_pager():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_documents), "__call__") as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            document.ListDocumentsResponse(
+                documents=[
+                    document.Document(),
+                    document.Document(),
+                    document.Document(),
+                ],
+                next_page_token="abc",
+            ),
+            document.ListDocumentsResponse(documents=[], next_page_token="def",),
+            document.ListDocumentsResponse(
+                documents=[document.Document(),], next_page_token="ghi",
+            ),
+            document.ListDocumentsResponse(
+                documents=[document.Document(), document.Document(),],
+            ),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_documents(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, document.Document) for i in results)
+
+
+def test_list_documents_pages():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_documents), "__call__") as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            document.ListDocumentsResponse(
+                documents=[
+                    document.Document(),
+                    document.Document(),
+                    document.Document(),
+                ],
+                next_page_token="abc",
+            ),
+            document.ListDocumentsResponse(documents=[], next_page_token="def",),
+            document.ListDocumentsResponse(
+                documents=[document.Document(),], next_page_token="ghi",
+            ),
+            document.ListDocumentsResponse(
+                documents=[document.Document(), document.Document(),],
+            ),
+            RuntimeError,
+        )
+        pages = list(client.list_documents(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_documents_async_pager():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_documents), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            document.ListDocumentsResponse(
+                documents=[
+                    document.Document(),
+                    document.Document(),
+                    document.Document(),
+                ],
+                next_page_token="abc",
+            ),
+            document.ListDocumentsResponse(documents=[], next_page_token="def",),
+            document.ListDocumentsResponse(
+                documents=[document.Document(),], next_page_token="ghi",
+            ),
+            document.ListDocumentsResponse(
+                documents=[document.Document(), document.Document(),],
+            ),
+            RuntimeError,
+        )
+        async_pager = await client.list_documents(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, document.Document) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_list_documents_async_pages():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_documents), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            document.ListDocumentsResponse(
+                documents=[
+                    document.Document(),
+                    document.Document(),
+                    document.Document(),
+                ],
+                next_page_token="abc",
+            ),
+            document.ListDocumentsResponse(documents=[], next_page_token="def",),
+            document.ListDocumentsResponse(
+                documents=[document.Document(),], next_page_token="ghi",
+            ),
+            document.ListDocumentsResponse(
+                documents=[document.Document(), document.Document(),],
+            ),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_documents(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_get_document(
+    transport: str = "grpc", request_type=document.GetDocumentRequest
+):
+    client = DocumentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = document.Document(
+            name="name_value",
+            display_name="display_name_value",
+            mime_type="mime_type_value",
+            knowledge_types=[document.Document.KnowledgeType.FAQ],
+            enable_auto_reload=True,
+            content_uri="content_uri_value",
+        )
+
+        response = client.get_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == document.GetDocumentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, document.Document)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.mime_type == "mime_type_value"
+
+    assert response.knowledge_types == [document.Document.KnowledgeType.FAQ]
+
+    assert response.enable_auto_reload is True
+
+
+def test_get_document_from_dict():
+    test_get_document(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_document_async(
+    transport: str = "grpc_asyncio", request_type=document.GetDocumentRequest
+):
+    client = DocumentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            document.Document(
+                name="name_value",
+                display_name="display_name_value",
+                mime_type="mime_type_value",
+                knowledge_types=[document.Document.KnowledgeType.FAQ],
+                enable_auto_reload=True,
+            )
+        )
+
+        response = await client.get_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == document.GetDocumentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, document.Document)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.mime_type == "mime_type_value"
+
+    assert response.knowledge_types == [document.Document.KnowledgeType.FAQ]
+
+    assert response.enable_auto_reload is True
+
+
+@pytest.mark.asyncio
+async def test_get_document_async_from_dict():
+    await test_get_document_async(request_type=dict)
+
+
+def test_get_document_field_headers():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = document.GetDocumentRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_document), "__call__") as call:
+        call.return_value = document.Document()
+
+        client.get_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_get_document_field_headers_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = document.GetDocumentRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_document), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(document.Document())
+
+        await client.get_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_get_document_flattened():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = document.Document()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.get_document(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_get_document_flattened_error():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.get_document(
+            document.GetDocumentRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_document_flattened_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = document.Document()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(document.Document())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.get_document(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_get_document_flattened_error_async():
+    client = DocumentsAsyncClient(credentials=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_document(
+            document.GetDocumentRequest(), name="name_value",
+        )
+
+
+def test_create_document(
+    transport: str = "grpc", request_type=gcd_document.CreateDocumentRequest
+):
+    client = DocumentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.create_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_document.CreateDocumentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_create_document_from_dict():
+    test_create_document(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_create_document_async(
+    transport: str = "grpc_asyncio", request_type=gcd_document.CreateDocumentRequest
+):
+    client = DocumentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.create_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_document.CreateDocumentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_create_document_async_from_dict():
+    await test_create_document_async(request_type=dict)
+
+
+def test_create_document_field_headers():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_document.CreateDocumentRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_document), "__call__") as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.create_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_create_document_field_headers_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_document.CreateDocumentRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_document), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.create_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_create_document_flattened():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        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.create_document(
+            parent="parent_value", document=gcd_document.Document(name="name_value"),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].document == gcd_document.Document(name="name_value")
+
+
+def test_create_document_flattened_error():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.create_document(
+            gcd_document.CreateDocumentRequest(),
+            parent="parent_value",
+            document=gcd_document.Document(name="name_value"),
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_document_flattened_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.create_document(
+            parent="parent_value", document=gcd_document.Document(name="name_value"),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].document == gcd_document.Document(name="name_value")
+
+
+@pytest.mark.asyncio
+async def test_create_document_flattened_error_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.create_document(
+            gcd_document.CreateDocumentRequest(),
+            parent="parent_value",
+            document=gcd_document.Document(name="name_value"),
+        )
+
+
+def test_delete_document(
+    transport: str = "grpc", request_type=document.DeleteDocumentRequest
+):
+    client = DocumentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.delete_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == document.DeleteDocumentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_delete_document_from_dict():
+    test_delete_document(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_document_async(
+    transport: str = "grpc_asyncio", request_type=document.DeleteDocumentRequest
+):
+    client = DocumentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.delete_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == document.DeleteDocumentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_delete_document_async_from_dict():
+    await test_delete_document_async(request_type=dict)
+
+
+def test_delete_document_field_headers():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = document.DeleteDocumentRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_document), "__call__") as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.delete_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_delete_document_field_headers_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = document.DeleteDocumentRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_document), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.delete_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_delete_document_flattened():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        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.delete_document(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_delete_document_flattened_error():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.delete_document(
+            document.DeleteDocumentRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_document_flattened_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.delete_document(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_document_flattened_error_async():
+    client = DocumentsAsyncClient(credentials=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_document(
+            document.DeleteDocumentRequest(), name="name_value",
+        )
+
+
+def test_update_document(
+    transport: str = "grpc", request_type=gcd_document.UpdateDocumentRequest
+):
+    client = DocumentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.update_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_document.UpdateDocumentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_update_document_from_dict():
+    test_update_document(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_update_document_async(
+    transport: str = "grpc_asyncio", request_type=gcd_document.UpdateDocumentRequest
+):
+    client = DocumentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.update_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_document.UpdateDocumentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_update_document_async_from_dict():
+    await test_update_document_async(request_type=dict)
+
+
+def test_update_document_field_headers():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_document.UpdateDocumentRequest()
+    request.document.name = "document.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_document), "__call__") as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.update_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "document.name=document.name/value",) in kw[
+        "metadata"
+    ]
+
+
+@pytest.mark.asyncio
+async def test_update_document_field_headers_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_document.UpdateDocumentRequest()
+    request.document.name = "document.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_document), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.update_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "document.name=document.name/value",) in kw[
+        "metadata"
+    ]
+
+
+def test_update_document_flattened():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        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.update_document(
+            document=gcd_document.Document(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].document == gcd_document.Document(name="name_value")
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+def test_update_document_flattened_error():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.update_document(
+            gcd_document.UpdateDocumentRequest(),
+            document=gcd_document.Document(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+@pytest.mark.asyncio
+async def test_update_document_flattened_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.update_document(
+            document=gcd_document.Document(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].document == gcd_document.Document(name="name_value")
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+@pytest.mark.asyncio
+async def test_update_document_flattened_error_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.update_document(
+            gcd_document.UpdateDocumentRequest(),
+            document=gcd_document.Document(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+def test_reload_document(
+    transport: str = "grpc", request_type=document.ReloadDocumentRequest
+):
+    client = DocumentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.reload_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.reload_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == document.ReloadDocumentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_reload_document_from_dict():
+    test_reload_document(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_reload_document_async(
+    transport: str = "grpc_asyncio", request_type=document.ReloadDocumentRequest
+):
+    client = DocumentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.reload_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.reload_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == document.ReloadDocumentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_reload_document_async_from_dict():
+    await test_reload_document_async(request_type=dict)
+
+
+def test_reload_document_field_headers():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = document.ReloadDocumentRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.reload_document), "__call__") as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.reload_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_reload_document_field_headers_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = document.ReloadDocumentRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.reload_document), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.reload_document(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_reload_document_flattened():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.reload_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        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.reload_document(
+            name="name_value", gcs_source=gcs.GcsSource(uri="uri_value"),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+        assert args[0].gcs_source == gcs.GcsSource(uri="uri_value")
+
+
+def test_reload_document_flattened_error():
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.reload_document(
+            document.ReloadDocumentRequest(),
+            name="name_value",
+            gcs_source=gcs.GcsSource(uri="uri_value"),
+        )
+
+
+@pytest.mark.asyncio
+async def test_reload_document_flattened_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.reload_document), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.reload_document(
+            name="name_value", gcs_source=gcs.GcsSource(uri="uri_value"),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+        assert args[0].gcs_source == gcs.GcsSource(uri="uri_value")
+
+
+@pytest.mark.asyncio
+async def test_reload_document_flattened_error_async():
+    client = DocumentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.reload_document(
+            document.ReloadDocumentRequest(),
+            name="name_value",
+            gcs_source=gcs.GcsSource(uri="uri_value"),
+        )
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.DocumentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = DocumentsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.DocumentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = DocumentsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.DocumentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = DocumentsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.DocumentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = DocumentsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.DocumentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.DocumentsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.DocumentsGrpcTransport, transports.DocumentsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = DocumentsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.DocumentsGrpcTransport,)
+
+
+def test_documents_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.DocumentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_documents_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.documents.transports.DocumentsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.DocumentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "list_documents",
+        "get_document",
+        "create_document",
+        "delete_document",
+        "update_document",
+        "reload_document",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+    # Additionally, the LRO client (a property) should
+    # also raise NotImplementedError
+    with pytest.raises(NotImplementedError):
+        transport.operations_client
+
+
+def test_documents_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.documents.transports.DocumentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.DocumentsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_documents_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.documents.transports.DocumentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.DocumentsTransport()
+        adc.assert_called_once()
+
+
+def test_documents_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        DocumentsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_documents_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.DocumentsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_documents_host_no_port():
+    client = DocumentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_documents_host_with_port():
+    client = DocumentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_documents_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.DocumentsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_documents_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.DocumentsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.DocumentsGrpcTransport, transports.DocumentsGrpcAsyncIOTransport],
+)
+def test_documents_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.DocumentsGrpcTransport, transports.DocumentsGrpcAsyncIOTransport],
+)
+def test_documents_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_documents_grpc_lro_client():
+    client = DocumentsClient(
+        credentials=credentials.AnonymousCredentials(), transport="grpc",
+    )
+    transport = client.transport
+
+    # Ensure that we have a api-core operations client.
+    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
+
+
+def test_documents_grpc_lro_async_client():
+    client = DocumentsAsyncClient(
+        credentials=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,)
+
+    # Ensure that subsequent calls to the property send the exact same object.
+    assert transport.operations_client is transport.operations_client
+
+
+def test_document_path():
+    project = "squid"
+    knowledge_base = "clam"
+    document = "whelk"
+
+    expected = "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}".format(
+        project=project, knowledge_base=knowledge_base, document=document,
+    )
+    actual = DocumentsClient.document_path(project, knowledge_base, document)
+    assert expected == actual
+
+
+def test_parse_document_path():
+    expected = {
+        "project": "octopus",
+        "knowledge_base": "oyster",
+        "document": "nudibranch",
+    }
+    path = DocumentsClient.document_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = DocumentsClient.parse_document_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "cuttlefish"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = DocumentsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "mussel",
+    }
+    path = DocumentsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = DocumentsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "winkle"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = DocumentsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "nautilus",
+    }
+    path = DocumentsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = DocumentsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "scallop"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = DocumentsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "abalone",
+    }
+    path = DocumentsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = DocumentsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "squid"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = DocumentsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "clam",
+    }
+    path = DocumentsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = DocumentsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "whelk"
+    location = "octopus"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = DocumentsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "oyster",
+        "location": "nudibranch",
+    }
+    path = DocumentsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = DocumentsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.DocumentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = DocumentsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.DocumentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = DocumentsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_entity_types.py b/tests/unit/gapic/dialogflow_v2beta1/test_entity_types.py
new file mode 100644
index 000000000..1e35f6c15
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2beta1/test_entity_types.py
@@ -0,0 +1,3238 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import future
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.api_core import operation_async  # type: ignore
+from google.api_core import operations_v1
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2beta1.services.entity_types import EntityTypesAsyncClient
+from google.cloud.dialogflow_v2beta1.services.entity_types import EntityTypesClient
+from google.cloud.dialogflow_v2beta1.services.entity_types import pagers
+from google.cloud.dialogflow_v2beta1.services.entity_types import transports
+from google.cloud.dialogflow_v2beta1.types import entity_type
+from google.cloud.dialogflow_v2beta1.types import entity_type as gcd_entity_type
+from google.longrunning import operations_pb2
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import struct_pb2 as struct  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert EntityTypesClient._get_default_mtls_endpoint(None) is None
+    assert (
+        EntityTypesClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    )
+    assert (
+        EntityTypesClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        EntityTypesClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        EntityTypesClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_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_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_entity_types_client_get_transport_class():
+    transport = EntityTypesClient.get_transport_class()
+    assert transport == transports.EntityTypesGrpcTransport
+
+    transport = EntityTypesClient.get_transport_class("grpc")
+    assert transport == transports.EntityTypesGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EntityTypesClient, transports.EntityTypesGrpcTransport, "grpc"),
+        (
+            EntityTypesAsyncClient,
+            transports.EntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+@mock.patch.object(
+    EntityTypesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(EntityTypesClient)
+)
+@mock.patch.object(
+    EntityTypesAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(EntityTypesAsyncClient),
+)
+def test_entity_types_client_client_options(
+    client_class, transport_class, transport_name
+):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(EntityTypesClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(EntityTypesClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (EntityTypesClient, transports.EntityTypesGrpcTransport, "grpc", "true"),
+        (
+            EntityTypesAsyncClient,
+            transports.EntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (EntityTypesClient, transports.EntityTypesGrpcTransport, "grpc", "false"),
+        (
+            EntityTypesAsyncClient,
+            transports.EntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    EntityTypesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(EntityTypesClient)
+)
+@mock.patch.object(
+    EntityTypesAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(EntityTypesAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_entity_types_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EntityTypesClient, transports.EntityTypesGrpcTransport, "grpc"),
+        (
+            EntityTypesAsyncClient,
+            transports.EntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EntityTypesClient, transports.EntityTypesGrpcTransport, "grpc"),
+        (
+            EntityTypesAsyncClient,
+            transports.EntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+def test_entity_types_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_entity_types_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.entity_types.transports.EntityTypesGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = EntityTypesClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_entity_types(
+    transport: str = "grpc", request_type=entity_type.ListEntityTypesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = entity_type.ListEntityTypesResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.ListEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListEntityTypesPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_entity_types_from_dict():
+    test_list_entity_types(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.ListEntityTypesRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.ListEntityTypesResponse(
+                next_page_token="next_page_token_value",
+            )
+        )
+
+        response = await client.list_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.ListEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListEntityTypesAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_async_from_dict():
+    await test_list_entity_types_async(request_type=dict)
+
+
+def test_list_entity_types_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        call.return_value = entity_type.ListEntityTypesResponse()
+
+        client.list_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.ListEntityTypesResponse()
+        )
+
+        await client.list_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_entity_types_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_list_entity_types_flattened_error():
+    client = EntityTypesClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = entity_type.ListEntityTypesResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.ListEntityTypesResponse()
+        )
+        # 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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+def test_list_entity_types_pager():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            entity_type.ListEntityTypesResponse(
+                entity_types=[
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[], next_page_token="def",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(),], next_page_token="ghi",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(), entity_type.EntityType(),],
+            ),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_entity_types(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, entity_type.EntityType) for i in results)
+
+
+def test_list_entity_types_pages():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            entity_type.ListEntityTypesResponse(
+                entity_types=[
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[], next_page_token="def",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(),], next_page_token="ghi",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(), entity_type.EntityType(),],
+            ),
+            RuntimeError,
+        )
+        pages = list(client.list_entity_types(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_async_pager():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            entity_type.ListEntityTypesResponse(
+                entity_types=[
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[], next_page_token="def",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(),], next_page_token="ghi",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(), entity_type.EntityType(),],
+            ),
+            RuntimeError,
+        )
+        async_pager = await client.list_entity_types(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, entity_type.EntityType) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_list_entity_types_async_pages():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_entity_types),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            entity_type.ListEntityTypesResponse(
+                entity_types=[
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                    entity_type.EntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[], next_page_token="def",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(),], next_page_token="ghi",
+            ),
+            entity_type.ListEntityTypesResponse(
+                entity_types=[entity_type.EntityType(), entity_type.EntityType(),],
+            ),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_entity_types(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_get_entity_type(
+    transport: str = "grpc", request_type=entity_type.GetEntityTypeRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # 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:
+        # Designate an appropriate return value for the call.
+        call.return_value = entity_type.EntityType(
+            name="name_value",
+            display_name="display_name_value",
+            kind=entity_type.EntityType.Kind.KIND_MAP,
+            auto_expansion_mode=entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+            enable_fuzzy_extraction=True,
+        )
+
+        response = client.get_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.GetEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+def test_get_entity_type_from_dict():
+    test_get_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_entity_type_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.GetEntityTypeRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # 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:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.EntityType(
+                name="name_value",
+                display_name="display_name_value",
+                kind=entity_type.EntityType.Kind.KIND_MAP,
+                auto_expansion_mode=entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+                enable_fuzzy_extraction=True,
+            )
+        )
+
+        response = await client.get_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.GetEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+@pytest.mark.asyncio
+async def test_get_entity_type_async_from_dict():
+    await test_get_entity_type_async(request_type=dict)
+
+
+def test_get_entity_type_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # 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:
+        call.return_value = entity_type.EntityType()
+
+        client.get_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # 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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.EntityType()
+        )
+
+        await client.get_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_get_entity_type_flattened():
+    client = EntityTypesClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_get_entity_type_flattened_error():
+    client = EntityTypesClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_entity_type_flattened_async():
+    client = EntityTypesAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = entity_type.EntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            entity_type.EntityType()
+        )
+        # 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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_get_entity_type_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+def test_create_entity_type(
+    transport: str = "grpc", request_type=gcd_entity_type.CreateEntityTypeRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType(
+            name="name_value",
+            display_name="display_name_value",
+            kind=gcd_entity_type.EntityType.Kind.KIND_MAP,
+            auto_expansion_mode=gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+            enable_fuzzy_extraction=True,
+        )
+
+        response = client.create_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_entity_type.CreateEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == gcd_entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+def test_create_entity_type_from_dict():
+    test_create_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_create_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=gcd_entity_type.CreateEntityTypeRequest,
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType(
+                name="name_value",
+                display_name="display_name_value",
+                kind=gcd_entity_type.EntityType.Kind.KIND_MAP,
+                auto_expansion_mode=gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+                enable_fuzzy_extraction=True,
+            )
+        )
+
+        response = await client.create_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_entity_type.CreateEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == gcd_entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+@pytest.mark.asyncio
+async def test_create_entity_type_async_from_dict():
+    await test_create_entity_type_async(request_type=dict)
+
+
+def test_create_entity_type_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_entity_type.CreateEntityTypeRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        call.return_value = gcd_entity_type.EntityType()
+
+        client.create_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_entity_type.CreateEntityTypeRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType()
+        )
+
+        await client.create_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_create_entity_type_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.create_entity_type(
+            parent="parent_value",
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_type == gcd_entity_type.EntityType(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_create_entity_type_flattened_error():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.create_entity_type(
+            gcd_entity_type.CreateEntityTypeRequest(),
+            parent="parent_value",
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_entity_type_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.create_entity_type(
+            parent="parent_value",
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_type == gcd_entity_type.EntityType(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_create_entity_type_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.create_entity_type(
+            gcd_entity_type.CreateEntityTypeRequest(),
+            parent="parent_value",
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+        )
+
+
+def test_update_entity_type(
+    transport: str = "grpc", request_type=gcd_entity_type.UpdateEntityTypeRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType(
+            name="name_value",
+            display_name="display_name_value",
+            kind=gcd_entity_type.EntityType.Kind.KIND_MAP,
+            auto_expansion_mode=gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+            enable_fuzzy_extraction=True,
+        )
+
+        response = client.update_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_entity_type.UpdateEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == gcd_entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+def test_update_entity_type_from_dict():
+    test_update_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_update_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=gcd_entity_type.UpdateEntityTypeRequest,
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType(
+                name="name_value",
+                display_name="display_name_value",
+                kind=gcd_entity_type.EntityType.Kind.KIND_MAP,
+                auto_expansion_mode=gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT,
+                enable_fuzzy_extraction=True,
+            )
+        )
+
+        response = await client.update_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_entity_type.UpdateEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_entity_type.EntityType)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.kind == gcd_entity_type.EntityType.Kind.KIND_MAP
+
+    assert (
+        response.auto_expansion_mode
+        == gcd_entity_type.EntityType.AutoExpansionMode.AUTO_EXPANSION_MODE_DEFAULT
+    )
+
+    assert response.enable_fuzzy_extraction is True
+
+
+@pytest.mark.asyncio
+async def test_update_entity_type_async_from_dict():
+    await test_update_entity_type_async(request_type=dict)
+
+
+def test_update_entity_type_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_entity_type.UpdateEntityTypeRequest()
+    request.entity_type.name = "entity_type.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        call.return_value = gcd_entity_type.EntityType()
+
+        client.update_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # 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"
+    ]
+
+
+@pytest.mark.asyncio
+async def test_update_entity_type_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_entity_type.UpdateEntityTypeRequest()
+    request.entity_type.name = "entity_type.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType()
+        )
+
+        await client.update_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # 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"
+    ]
+
+
+def test_update_entity_type_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.update_entity_type(
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].entity_type == gcd_entity_type.EntityType(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+def test_update_entity_type_flattened_error():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.update_entity_type(
+            gcd_entity_type.UpdateEntityTypeRequest(),
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+@pytest.mark.asyncio
+async def test_update_entity_type_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_entity_type.EntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_entity_type.EntityType()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.update_entity_type(
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].entity_type == gcd_entity_type.EntityType(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+@pytest.mark.asyncio
+async def test_update_entity_type_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.update_entity_type(
+            gcd_entity_type.UpdateEntityTypeRequest(),
+            entity_type=gcd_entity_type.EntityType(name="name_value"),
+            language_code="language_code_value",
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+def test_delete_entity_type(
+    transport: str = "grpc", request_type=entity_type.DeleteEntityTypeRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.DeleteEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_entity_type_from_dict():
+    test_delete_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_entity_type_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.DeleteEntityTypeRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.DeleteEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_entity_type_async_from_dict():
+    await test_delete_entity_type_async(request_type=dict)
+
+
+def test_delete_entity_type_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        call.return_value = None
+
+        client.delete_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_delete_entity_type_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_delete_entity_type_flattened_error():
+    client = EntityTypesClient(credentials=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",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_entity_type_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_entity_type_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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",
+        )
+
+
+def test_batch_update_entity_types(
+    transport: str = "grpc", request_type=entity_type.BatchUpdateEntityTypesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_update_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchUpdateEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_update_entity_types_from_dict():
+    test_batch_update_entity_types(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entity_types_async(
+    transport: str = "grpc_asyncio",
+    request_type=entity_type.BatchUpdateEntityTypesRequest,
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_update_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchUpdateEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entity_types_async_from_dict():
+    await test_batch_update_entity_types_async(request_type=dict)
+
+
+def test_batch_update_entity_types_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entity_types), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_update_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entity_types_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entity_types), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_update_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_delete_entity_types(
+    transport: str = "grpc", request_type=entity_type.BatchDeleteEntityTypesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_delete_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchDeleteEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_delete_entity_types_from_dict():
+    test_batch_delete_entity_types(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entity_types_async(
+    transport: str = "grpc_asyncio",
+    request_type=entity_type.BatchDeleteEntityTypesRequest,
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_delete_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchDeleteEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entity_types_async_from_dict():
+    await test_batch_delete_entity_types_async(request_type=dict)
+
+
+def test_batch_delete_entity_types_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_delete_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entity_types_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_delete_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_delete_entity_types_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_delete_entity_types(
+            parent="parent_value", entity_type_names=["entity_type_names_value"],
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_type_names == ["entity_type_names_value"]
+
+
+def test_batch_delete_entity_types_flattened_error():
+    client = EntityTypesClient(credentials=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_entity_types(
+            entity_type.BatchDeleteEntityTypesRequest(),
+            parent="parent_value",
+            entity_type_names=["entity_type_names_value"],
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entity_types_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_delete_entity_types(
+            parent="parent_value", entity_type_names=["entity_type_names_value"],
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_type_names == ["entity_type_names_value"]
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entity_types_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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_entity_types(
+            entity_type.BatchDeleteEntityTypesRequest(),
+            parent="parent_value",
+            entity_type_names=["entity_type_names_value"],
+        )
+
+
+def test_batch_create_entities(
+    transport: str = "grpc", request_type=entity_type.BatchCreateEntitiesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_create_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchCreateEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_create_entities_from_dict():
+    test_batch_create_entities(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_create_entities_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.BatchCreateEntitiesRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_create_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchCreateEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_create_entities_async_from_dict():
+    await test_batch_create_entities_async(request_type=dict)
+
+
+def test_batch_create_entities_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchCreateEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_create_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_create_entities_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchCreateEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_create_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_create_entities_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_create_entities(
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entities == [entity_type.EntityType.Entity(value="value_value")]
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_batch_create_entities_flattened_error():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.batch_create_entities(
+            entity_type.BatchCreateEntitiesRequest(),
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_create_entities_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_create_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_create_entities(
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entities == [entity_type.EntityType.Entity(value="value_value")]
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_batch_create_entities_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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_create_entities(
+            entity_type.BatchCreateEntitiesRequest(),
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+
+def test_batch_update_entities(
+    transport: str = "grpc", request_type=entity_type.BatchUpdateEntitiesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_update_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchUpdateEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_update_entities_from_dict():
+    test_batch_update_entities(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entities_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.BatchUpdateEntitiesRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_update_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchUpdateEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entities_async_from_dict():
+    await test_batch_update_entities_async(request_type=dict)
+
+
+def test_batch_update_entities_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_update_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entities_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_update_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_update_entities_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_update_entities(
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entities == [entity_type.EntityType.Entity(value="value_value")]
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_batch_update_entities_flattened_error():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.batch_update_entities(
+            entity_type.BatchUpdateEntitiesRequest(),
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entities_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_update_entities(
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entities == [entity_type.EntityType.Entity(value="value_value")]
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_batch_update_entities_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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_update_entities(
+            entity_type.BatchUpdateEntitiesRequest(),
+            parent="parent_value",
+            entities=[entity_type.EntityType.Entity(value="value_value")],
+            language_code="language_code_value",
+        )
+
+
+def test_batch_delete_entities(
+    transport: str = "grpc", request_type=entity_type.BatchDeleteEntitiesRequest
+):
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_delete_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchDeleteEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_delete_entities_from_dict():
+    test_batch_delete_entities(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entities_async(
+    transport: str = "grpc_asyncio", request_type=entity_type.BatchDeleteEntitiesRequest
+):
+    client = EntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_delete_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == entity_type.BatchDeleteEntitiesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entities_async_from_dict():
+    await test_batch_delete_entities_async(request_type=dict)
+
+
+def test_batch_delete_entities_field_headers():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_delete_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entities_field_headers_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteEntitiesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_delete_entities(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_delete_entities_flattened():
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_delete_entities(
+            parent="parent_value",
+            entity_values=["entity_values_value"],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_values == ["entity_values_value"]
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_batch_delete_entities_flattened_error():
+    client = EntityTypesClient(credentials=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_entities(
+            entity_type.BatchDeleteEntitiesRequest(),
+            parent="parent_value",
+            entity_values=["entity_values_value"],
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entities_flattened_async():
+    client = EntityTypesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_entities), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_delete_entities(
+            parent="parent_value",
+            entity_values=["entity_values_value"],
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].entity_values == ["entity_values_value"]
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_entities_flattened_error_async():
+    client = EntityTypesAsyncClient(credentials=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_entities(
+            entity_type.BatchDeleteEntitiesRequest(),
+            parent="parent_value",
+            entity_values=["entity_values_value"],
+            language_code="language_code_value",
+        )
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.EntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EntityTypesClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.EntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EntityTypesClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.EntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EntityTypesClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.EntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = EntityTypesClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.EntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.EntityTypesGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EntityTypesGrpcTransport, transports.EntityTypesGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = EntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.EntityTypesGrpcTransport,)
+
+
+def test_entity_types_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.EntityTypesTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_entity_types_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.entity_types.transports.EntityTypesTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.EntityTypesTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "list_entity_types",
+        "get_entity_type",
+        "create_entity_type",
+        "update_entity_type",
+        "delete_entity_type",
+        "batch_update_entity_types",
+        "batch_delete_entity_types",
+        "batch_create_entities",
+        "batch_update_entities",
+        "batch_delete_entities",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+    # Additionally, the LRO client (a property) should
+    # also raise NotImplementedError
+    with pytest.raises(NotImplementedError):
+        transport.operations_client
+
+
+def test_entity_types_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.entity_types.transports.EntityTypesTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.EntityTypesTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_entity_types_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.entity_types.transports.EntityTypesTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.EntityTypesTransport()
+        adc.assert_called_once()
+
+
+def test_entity_types_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        EntityTypesClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_entity_types_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.EntityTypesGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_entity_types_host_no_port():
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_entity_types_host_with_port():
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_entity_types_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.EntityTypesGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_entity_types_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.EntityTypesGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EntityTypesGrpcTransport, transports.EntityTypesGrpcAsyncIOTransport],
+)
+def test_entity_types_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EntityTypesGrpcTransport, transports.EntityTypesGrpcAsyncIOTransport],
+)
+def test_entity_types_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_entity_types_grpc_lro_client():
+    client = EntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport="grpc",
+    )
+    transport = client.transport
+
+    # Ensure that we have a api-core operations client.
+    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
+
+
+def test_entity_types_grpc_lro_async_client():
+    client = EntityTypesAsyncClient(
+        credentials=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,)
+
+    # Ensure that subsequent calls to the property send the exact same object.
+    assert transport.operations_client is transport.operations_client
+
+
+def test_entity_type_path():
+    project = "squid"
+    entity_type = "clam"
+
+    expected = "projects/{project}/agent/entityTypes/{entity_type}".format(
+        project=project, entity_type=entity_type,
+    )
+    actual = EntityTypesClient.entity_type_path(project, entity_type)
+    assert expected == actual
+
+
+def test_parse_entity_type_path():
+    expected = {
+        "project": "whelk",
+        "entity_type": "octopus",
+    }
+    path = EntityTypesClient.entity_type_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_entity_type_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "oyster"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = EntityTypesClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "nudibranch",
+    }
+    path = EntityTypesClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "cuttlefish"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = EntityTypesClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "mussel",
+    }
+    path = EntityTypesClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "winkle"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = EntityTypesClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "nautilus",
+    }
+    path = EntityTypesClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "scallop"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = EntityTypesClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "abalone",
+    }
+    path = EntityTypesClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "squid"
+    location = "clam"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = EntityTypesClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "whelk",
+        "location": "octopus",
+    }
+    path = EntityTypesClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EntityTypesClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.EntityTypesTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = EntityTypesClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.EntityTypesTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = EntityTypesClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_environments.py b/tests/unit/gapic/dialogflow_v2beta1/test_environments.py
new file mode 100644
index 000000000..1dffa247e
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2beta1/test_environments.py
@@ -0,0 +1,1227 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2beta1.services.environments import (
+    EnvironmentsAsyncClient,
+)
+from google.cloud.dialogflow_v2beta1.services.environments import EnvironmentsClient
+from google.cloud.dialogflow_v2beta1.services.environments import pagers
+from google.cloud.dialogflow_v2beta1.services.environments import transports
+from google.cloud.dialogflow_v2beta1.types import environment
+from google.oauth2 import service_account
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert EnvironmentsClient._get_default_mtls_endpoint(None) is None
+    assert (
+        EnvironmentsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    )
+    assert (
+        EnvironmentsClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        EnvironmentsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        EnvironmentsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_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_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_environments_client_get_transport_class():
+    transport = EnvironmentsClient.get_transport_class()
+    assert transport == transports.EnvironmentsGrpcTransport
+
+    transport = EnvironmentsClient.get_transport_class("grpc")
+    assert transport == transports.EnvironmentsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EnvironmentsClient, transports.EnvironmentsGrpcTransport, "grpc"),
+        (
+            EnvironmentsAsyncClient,
+            transports.EnvironmentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+@mock.patch.object(
+    EnvironmentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(EnvironmentsClient)
+)
+@mock.patch.object(
+    EnvironmentsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(EnvironmentsAsyncClient),
+)
+def test_environments_client_client_options(
+    client_class, transport_class, transport_name
+):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(EnvironmentsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(EnvironmentsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (EnvironmentsClient, transports.EnvironmentsGrpcTransport, "grpc", "true"),
+        (
+            EnvironmentsAsyncClient,
+            transports.EnvironmentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (EnvironmentsClient, transports.EnvironmentsGrpcTransport, "grpc", "false"),
+        (
+            EnvironmentsAsyncClient,
+            transports.EnvironmentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    EnvironmentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(EnvironmentsClient)
+)
+@mock.patch.object(
+    EnvironmentsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(EnvironmentsAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_environments_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EnvironmentsClient, transports.EnvironmentsGrpcTransport, "grpc"),
+        (
+            EnvironmentsAsyncClient,
+            transports.EnvironmentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (EnvironmentsClient, transports.EnvironmentsGrpcTransport, "grpc"),
+        (
+            EnvironmentsAsyncClient,
+            transports.EnvironmentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+def test_environments_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_environments_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.environments.transports.EnvironmentsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = EnvironmentsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_environments(
+    transport: str = "grpc", request_type=environment.ListEnvironmentsRequest
+):
+    client = EnvironmentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = environment.ListEnvironmentsResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_environments(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == environment.ListEnvironmentsRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListEnvironmentsPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_environments_from_dict():
+    test_list_environments(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_environments_async(
+    transport: str = "grpc_asyncio", request_type=environment.ListEnvironmentsRequest
+):
+    client = EnvironmentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            environment.ListEnvironmentsResponse(
+                next_page_token="next_page_token_value",
+            )
+        )
+
+        response = await client.list_environments(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == environment.ListEnvironmentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListEnvironmentsAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_environments_async_from_dict():
+    await test_list_environments_async(request_type=dict)
+
+
+def test_list_environments_field_headers():
+    client = EnvironmentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        call.return_value = environment.ListEnvironmentsResponse()
+
+        client.list_environments(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            environment.ListEnvironmentsResponse()
+        )
+
+        await client.list_environments(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_environments_flattened():
+    client = EnvironmentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_list_environments_flattened_error():
+    client = EnvironmentsClient(credentials=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",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_environments_flattened_async():
+    client = EnvironmentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = environment.ListEnvironmentsResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            environment.ListEnvironmentsResponse()
+        )
+        # 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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_list_environments_flattened_error_async():
+    client = EnvironmentsAsyncClient(credentials=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",
+        )
+
+
+def test_list_environments_pager():
+    client = EnvironmentsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            environment.ListEnvironmentsResponse(
+                environments=[
+                    environment.Environment(),
+                    environment.Environment(),
+                    environment.Environment(),
+                ],
+                next_page_token="abc",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[], next_page_token="def",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(),], next_page_token="ghi",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(), environment.Environment(),],
+            ),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_environments(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, environment.Environment) for i in results)
+
+
+def test_list_environments_pages():
+    client = EnvironmentsClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            environment.ListEnvironmentsResponse(
+                environments=[
+                    environment.Environment(),
+                    environment.Environment(),
+                    environment.Environment(),
+                ],
+                next_page_token="abc",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[], next_page_token="def",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(),], next_page_token="ghi",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(), environment.Environment(),],
+            ),
+            RuntimeError,
+        )
+        pages = list(client.list_environments(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_environments_async_pager():
+    client = EnvironmentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            environment.ListEnvironmentsResponse(
+                environments=[
+                    environment.Environment(),
+                    environment.Environment(),
+                    environment.Environment(),
+                ],
+                next_page_token="abc",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[], next_page_token="def",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(),], next_page_token="ghi",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(), environment.Environment(),],
+            ),
+            RuntimeError,
+        )
+        async_pager = await client.list_environments(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, environment.Environment) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_list_environments_async_pages():
+    client = EnvironmentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_environments),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            environment.ListEnvironmentsResponse(
+                environments=[
+                    environment.Environment(),
+                    environment.Environment(),
+                    environment.Environment(),
+                ],
+                next_page_token="abc",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[], next_page_token="def",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(),], next_page_token="ghi",
+            ),
+            environment.ListEnvironmentsResponse(
+                environments=[environment.Environment(), environment.Environment(),],
+            ),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_environments(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.EnvironmentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EnvironmentsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.EnvironmentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EnvironmentsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.EnvironmentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = EnvironmentsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.EnvironmentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = EnvironmentsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.EnvironmentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.EnvironmentsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EnvironmentsGrpcTransport, transports.EnvironmentsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = EnvironmentsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.EnvironmentsGrpcTransport,)
+
+
+def test_environments_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.EnvironmentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_environments_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.environments.transports.EnvironmentsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.EnvironmentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = ("list_environments",)
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+
+def test_environments_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.environments.transports.EnvironmentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.EnvironmentsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_environments_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.environments.transports.EnvironmentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.EnvironmentsTransport()
+        adc.assert_called_once()
+
+
+def test_environments_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        EnvironmentsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_environments_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.EnvironmentsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_environments_host_no_port():
+    client = EnvironmentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_environments_host_with_port():
+    client = EnvironmentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_environments_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.EnvironmentsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_environments_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.EnvironmentsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EnvironmentsGrpcTransport, transports.EnvironmentsGrpcAsyncIOTransport],
+)
+def test_environments_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.EnvironmentsGrpcTransport, transports.EnvironmentsGrpcAsyncIOTransport],
+)
+def test_environments_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_environment_path():
+    project = "squid"
+    environment = "clam"
+
+    expected = "projects/{project}/agent/environments/{environment}".format(
+        project=project, environment=environment,
+    )
+    actual = EnvironmentsClient.environment_path(project, environment)
+    assert expected == actual
+
+
+def test_parse_environment_path():
+    expected = {
+        "project": "whelk",
+        "environment": "octopus",
+    }
+    path = EnvironmentsClient.environment_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_environment_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "oyster"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = EnvironmentsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "nudibranch",
+    }
+    path = EnvironmentsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "cuttlefish"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = EnvironmentsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "mussel",
+    }
+    path = EnvironmentsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "winkle"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = EnvironmentsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "nautilus",
+    }
+    path = EnvironmentsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "scallop"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = EnvironmentsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "abalone",
+    }
+    path = EnvironmentsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "squid"
+    location = "clam"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = EnvironmentsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "whelk",
+        "location": "octopus",
+    }
+    path = EnvironmentsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = EnvironmentsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.EnvironmentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = EnvironmentsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.EnvironmentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = EnvironmentsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_intents.py b/tests/unit/gapic/dialogflow_v2beta1/test_intents.py
new file mode 100644
index 000000000..f102d89b3
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2beta1/test_intents.py
@@ -0,0 +1,2753 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import future
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.api_core import operation_async  # type: ignore
+from google.api_core import operations_v1
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2beta1.services.intents import IntentsAsyncClient
+from google.cloud.dialogflow_v2beta1.services.intents import IntentsClient
+from google.cloud.dialogflow_v2beta1.services.intents import pagers
+from google.cloud.dialogflow_v2beta1.services.intents import transports
+from google.cloud.dialogflow_v2beta1.types import context
+from google.cloud.dialogflow_v2beta1.types import intent
+from google.cloud.dialogflow_v2beta1.types import intent as gcd_intent
+from google.longrunning import operations_pb2
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import struct_pb2 as struct  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert IntentsClient._get_default_mtls_endpoint(None) is None
+    assert IntentsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    assert (
+        IntentsClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint
+    )
+    assert (
+        IntentsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        IntentsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_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_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_intents_client_get_transport_class():
+    transport = IntentsClient.get_transport_class()
+    assert transport == transports.IntentsGrpcTransport
+
+    transport = IntentsClient.get_transport_class("grpc")
+    assert transport == transports.IntentsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (IntentsClient, transports.IntentsGrpcTransport, "grpc"),
+        (IntentsAsyncClient, transports.IntentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+@mock.patch.object(
+    IntentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(IntentsClient)
+)
+@mock.patch.object(
+    IntentsAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(IntentsAsyncClient)
+)
+def test_intents_client_client_options(client_class, transport_class, transport_name):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(IntentsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(IntentsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (IntentsClient, transports.IntentsGrpcTransport, "grpc", "true"),
+        (
+            IntentsAsyncClient,
+            transports.IntentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (IntentsClient, transports.IntentsGrpcTransport, "grpc", "false"),
+        (
+            IntentsAsyncClient,
+            transports.IntentsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    IntentsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(IntentsClient)
+)
+@mock.patch.object(
+    IntentsAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(IntentsAsyncClient)
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_intents_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (IntentsClient, transports.IntentsGrpcTransport, "grpc"),
+        (IntentsAsyncClient, transports.IntentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (IntentsClient, transports.IntentsGrpcTransport, "grpc"),
+        (IntentsAsyncClient, transports.IntentsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+def test_intents_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_intents_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.intents.transports.IntentsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = IntentsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_intents(transport: str = "grpc", request_type=intent.ListIntentsRequest):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_intents), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = intent.ListIntentsResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.ListIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListIntentsPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_intents_from_dict():
+    test_list_intents(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_intents_async(
+    transport: str = "grpc_asyncio", request_type=intent.ListIntentsRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    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",)
+        )
+
+        response = await client.list_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.ListIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListIntentsAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_intents_async_from_dict():
+    await test_list_intents_async(request_type=dict)
+
+
+def test_list_intents_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_intents), "__call__") as call:
+        call.return_value = intent.ListIntentsResponse()
+
+        client.list_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.list_intents), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            intent.ListIntentsResponse()
+        )
+
+        await client.list_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_intents_flattened():
+    client = IntentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_list_intents_flattened_error():
+    client = IntentsClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_intents_flattened_async():
+    client = IntentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = intent.ListIntentsResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            intent.ListIntentsResponse()
+        )
+        # 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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_list_intents_flattened_error_async():
+    client = IntentsAsyncClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+def test_list_intents_pager():
+    client = IntentsClient(credentials=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:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            intent.ListIntentsResponse(
+                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",
+            ),
+            intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_intents(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, intent.Intent) for i in results)
+
+
+def test_list_intents_pages():
+    client = IntentsClient(credentials=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:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            intent.ListIntentsResponse(
+                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",
+            ),
+            intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],),
+            RuntimeError,
+        )
+        pages = list(client.list_intents(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_intents_async_pager():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_intents), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            intent.ListIntentsResponse(
+                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",
+            ),
+            intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],),
+            RuntimeError,
+        )
+        async_pager = await client.list_intents(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, intent.Intent) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_list_intents_async_pages():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_intents), "__call__", new_callable=mock.AsyncMock
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            intent.ListIntentsResponse(
+                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",
+            ),
+            intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_intents(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_get_intent(transport: str = "grpc", request_type=intent.GetIntentRequest):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = intent.Intent(
+            name="name_value",
+            display_name="display_name_value",
+            webhook_state=intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+            priority=898,
+            is_fallback=True,
+            ml_enabled=True,
+            ml_disabled=True,
+            end_interaction=True,
+            input_context_names=["input_context_names_value"],
+            events=["events_value"],
+            action="action_value",
+            reset_contexts=True,
+            default_response_platforms=[intent.Intent.Message.Platform.FACEBOOK],
+            root_followup_intent_name="root_followup_intent_name_value",
+            parent_followup_intent_name="parent_followup_intent_name_value",
+        )
+
+        response = client.get_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.GetIntentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.webhook_state == intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_enabled is True
+
+    assert response.ml_disabled is True
+
+    assert response.end_interaction is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+def test_get_intent_from_dict():
+    test_get_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_intent_async(
+    transport: str = "grpc_asyncio", request_type=intent.GetIntentRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            intent.Intent(
+                name="name_value",
+                display_name="display_name_value",
+                webhook_state=intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+                priority=898,
+                is_fallback=True,
+                ml_enabled=True,
+                ml_disabled=True,
+                end_interaction=True,
+                input_context_names=["input_context_names_value"],
+                events=["events_value"],
+                action="action_value",
+                reset_contexts=True,
+                default_response_platforms=[intent.Intent.Message.Platform.FACEBOOK],
+                root_followup_intent_name="root_followup_intent_name_value",
+                parent_followup_intent_name="parent_followup_intent_name_value",
+            )
+        )
+
+        response = await client.get_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.GetIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.webhook_state == intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_enabled is True
+
+    assert response.ml_disabled is True
+
+    assert response.end_interaction is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+@pytest.mark.asyncio
+async def test_get_intent_async_from_dict():
+    await test_get_intent_async(request_type=dict)
+
+
+def test_get_intent_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_intent), "__call__") as call:
+        call.return_value = intent.Intent()
+
+        client.get_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.get_intent), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(intent.Intent())
+
+        await client.get_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_get_intent_flattened():
+    client = IntentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_get_intent_flattened_error():
+    client = IntentsClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_intent_flattened_async():
+    client = IntentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = intent.Intent()
+
+        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", language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_get_intent_flattened_error_async():
+    client = IntentsAsyncClient(credentials=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",
+            language_code="language_code_value",
+        )
+
+
+def test_create_intent(
+    transport: str = "grpc", request_type=gcd_intent.CreateIntentRequest
+):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent(
+            name="name_value",
+            display_name="display_name_value",
+            webhook_state=gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+            priority=898,
+            is_fallback=True,
+            ml_enabled=True,
+            ml_disabled=True,
+            end_interaction=True,
+            input_context_names=["input_context_names_value"],
+            events=["events_value"],
+            action="action_value",
+            reset_contexts=True,
+            default_response_platforms=[gcd_intent.Intent.Message.Platform.FACEBOOK],
+            root_followup_intent_name="root_followup_intent_name_value",
+            parent_followup_intent_name="parent_followup_intent_name_value",
+        )
+
+        response = client.create_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_intent.CreateIntentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert (
+        response.webhook_state == gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+    )
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_enabled is True
+
+    assert response.ml_disabled is True
+
+    assert response.end_interaction is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        gcd_intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+def test_create_intent_from_dict():
+    test_create_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_create_intent_async(
+    transport: str = "grpc_asyncio", request_type=gcd_intent.CreateIntentRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.create_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_intent.Intent(
+                name="name_value",
+                display_name="display_name_value",
+                webhook_state=gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+                priority=898,
+                is_fallback=True,
+                ml_enabled=True,
+                ml_disabled=True,
+                end_interaction=True,
+                input_context_names=["input_context_names_value"],
+                events=["events_value"],
+                action="action_value",
+                reset_contexts=True,
+                default_response_platforms=[
+                    gcd_intent.Intent.Message.Platform.FACEBOOK
+                ],
+                root_followup_intent_name="root_followup_intent_name_value",
+                parent_followup_intent_name="parent_followup_intent_name_value",
+            )
+        )
+
+        response = await client.create_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_intent.CreateIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert (
+        response.webhook_state == gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+    )
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_enabled is True
+
+    assert response.ml_disabled is True
+
+    assert response.end_interaction is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        gcd_intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+@pytest.mark.asyncio
+async def test_create_intent_async_from_dict():
+    await test_create_intent_async(request_type=dict)
+
+
+def test_create_intent_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_intent.CreateIntentRequest()
+    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:
+        call.return_value = gcd_intent.Intent()
+
+        client.create_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_intent.CreateIntentRequest()
+    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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_intent.Intent())
+
+        await client.create_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_create_intent_flattened():
+    client = IntentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent()
+
+        # 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=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intent == gcd_intent.Intent(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_create_intent_flattened_error():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.create_intent(
+            gcd_intent.CreateIntentRequest(),
+            parent="parent_value",
+            intent=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_intent_flattened_async():
+    client = IntentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_intent.Intent())
+        # 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=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intent == gcd_intent.Intent(name="name_value")
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_create_intent_flattened_error_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.create_intent(
+            gcd_intent.CreateIntentRequest(),
+            parent="parent_value",
+            intent=gcd_intent.Intent(name="name_value"),
+            language_code="language_code_value",
+        )
+
+
+def test_update_intent(
+    transport: str = "grpc", request_type=gcd_intent.UpdateIntentRequest
+):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent(
+            name="name_value",
+            display_name="display_name_value",
+            webhook_state=gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+            priority=898,
+            is_fallback=True,
+            ml_enabled=True,
+            ml_disabled=True,
+            end_interaction=True,
+            input_context_names=["input_context_names_value"],
+            events=["events_value"],
+            action="action_value",
+            reset_contexts=True,
+            default_response_platforms=[gcd_intent.Intent.Message.Platform.FACEBOOK],
+            root_followup_intent_name="root_followup_intent_name_value",
+            parent_followup_intent_name="parent_followup_intent_name_value",
+        )
+
+        response = client.update_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_intent.UpdateIntentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert (
+        response.webhook_state == gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+    )
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_enabled is True
+
+    assert response.ml_disabled is True
+
+    assert response.end_interaction is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        gcd_intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+def test_update_intent_from_dict():
+    test_update_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_update_intent_async(
+    transport: str = "grpc_asyncio", request_type=gcd_intent.UpdateIntentRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.update_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_intent.Intent(
+                name="name_value",
+                display_name="display_name_value",
+                webhook_state=gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED,
+                priority=898,
+                is_fallback=True,
+                ml_enabled=True,
+                ml_disabled=True,
+                end_interaction=True,
+                input_context_names=["input_context_names_value"],
+                events=["events_value"],
+                action="action_value",
+                reset_contexts=True,
+                default_response_platforms=[
+                    gcd_intent.Intent.Message.Platform.FACEBOOK
+                ],
+                root_followup_intent_name="root_followup_intent_name_value",
+                parent_followup_intent_name="parent_followup_intent_name_value",
+            )
+        )
+
+        response = await client.update_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_intent.UpdateIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_intent.Intent)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert (
+        response.webhook_state == gcd_intent.Intent.WebhookState.WEBHOOK_STATE_ENABLED
+    )
+
+    assert response.priority == 898
+
+    assert response.is_fallback is True
+
+    assert response.ml_enabled is True
+
+    assert response.ml_disabled is True
+
+    assert response.end_interaction is True
+
+    assert response.input_context_names == ["input_context_names_value"]
+
+    assert response.events == ["events_value"]
+
+    assert response.action == "action_value"
+
+    assert response.reset_contexts is True
+
+    assert response.default_response_platforms == [
+        gcd_intent.Intent.Message.Platform.FACEBOOK
+    ]
+
+    assert response.root_followup_intent_name == "root_followup_intent_name_value"
+
+    assert response.parent_followup_intent_name == "parent_followup_intent_name_value"
+
+
+@pytest.mark.asyncio
+async def test_update_intent_async_from_dict():
+    await test_update_intent_async(request_type=dict)
+
+
+def test_update_intent_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_intent.UpdateIntentRequest()
+    request.intent.name = "intent.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:
+        call.return_value = gcd_intent.Intent()
+
+        client.update_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # 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"]
+
+
+@pytest.mark.asyncio
+async def test_update_intent_field_headers_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_intent.UpdateIntentRequest()
+    request.intent.name = "intent.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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_intent.Intent())
+
+        await client.update_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # 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"]
+
+
+def test_update_intent_flattened():
+    client = IntentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.update_intent(
+            intent=gcd_intent.Intent(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].intent == gcd_intent.Intent(name="name_value")
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+        assert args[0].language_code == "language_code_value"
+
+
+def test_update_intent_flattened_error():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.update_intent(
+            gcd_intent.UpdateIntentRequest(),
+            intent=gcd_intent.Intent(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+            language_code="language_code_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_update_intent_flattened_async():
+    client = IntentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_intent.Intent()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gcd_intent.Intent())
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.update_intent(
+            intent=gcd_intent.Intent(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+            language_code="language_code_value",
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].intent == gcd_intent.Intent(name="name_value")
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+        assert args[0].language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_update_intent_flattened_error_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.update_intent(
+            gcd_intent.UpdateIntentRequest(),
+            intent=gcd_intent.Intent(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+            language_code="language_code_value",
+        )
+
+
+def test_delete_intent(
+    transport: str = "grpc", request_type=intent.DeleteIntentRequest
+):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.DeleteIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_intent_from_dict():
+    test_delete_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_intent_async(
+    transport: str = "grpc_asyncio", request_type=intent.DeleteIntentRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.DeleteIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_intent_async_from_dict():
+    await test_delete_intent_async(request_type=dict)
+
+
+def test_delete_intent_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_intent), "__call__") as call:
+        call.return_value = None
+
+        client.delete_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value 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"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.delete_intent), "__call__") as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_delete_intent_flattened():
+    client = IntentsClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_delete_intent_flattened_error():
+    client = IntentsClient(credentials=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",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_intent_flattened_async():
+    client = IntentsAsyncClient(credentials=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:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_intent_flattened_error_async():
+    client = IntentsAsyncClient(credentials=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",
+        )
+
+
+def test_batch_update_intents(
+    transport: str = "grpc", request_type=intent.BatchUpdateIntentsRequest
+):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_update_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.BatchUpdateIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_update_intents_from_dict():
+    test_batch_update_intents(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_intents_async(
+    transport: str = "grpc_asyncio", request_type=intent.BatchUpdateIntentsRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_update_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.BatchUpdateIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_update_intents_async_from_dict():
+    await test_batch_update_intents_async(request_type=dict)
+
+
+def test_batch_update_intents_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateIntentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_update_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_update_intents_field_headers_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchUpdateIntentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_update_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_update_intents_flattened():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_update_intents(
+            parent="parent_value",
+            intent_batch_uri="intent_batch_uri_value",
+            intent_batch_inline=intent.IntentBatch(
+                intents=[intent.Intent(name="name_value")]
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intent_batch_inline == intent.IntentBatch(
+            intents=[intent.Intent(name="name_value")]
+        )
+
+
+def test_batch_update_intents_flattened_error():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.batch_update_intents(
+            intent.BatchUpdateIntentsRequest(),
+            parent="parent_value",
+            intent_batch_uri="intent_batch_uri_value",
+            intent_batch_inline=intent.IntentBatch(
+                intents=[intent.Intent(name="name_value")]
+            ),
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_update_intents_flattened_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_update_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_update_intents(
+            parent="parent_value",
+            intent_batch_uri="intent_batch_uri_value",
+            intent_batch_inline=intent.IntentBatch(
+                intents=[intent.Intent(name="name_value")]
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intent_batch_inline == intent.IntentBatch(
+            intents=[intent.Intent(name="name_value")]
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_update_intents_flattened_error_async():
+    client = IntentsAsyncClient(credentials=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_update_intents(
+            intent.BatchUpdateIntentsRequest(),
+            parent="parent_value",
+            intent_batch_uri="intent_batch_uri_value",
+            intent_batch_inline=intent.IntentBatch(
+                intents=[intent.Intent(name="name_value")]
+            ),
+        )
+
+
+def test_batch_delete_intents(
+    transport: str = "grpc", request_type=intent.BatchDeleteIntentsRequest
+):
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/spam")
+
+        response = client.batch_delete_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.BatchDeleteIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+def test_batch_delete_intents_from_dict():
+    test_batch_delete_intents(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_intents_async(
+    transport: str = "grpc_asyncio", request_type=intent.BatchDeleteIntentsRequest
+):
+    client = IntentsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+
+        response = await client.batch_delete_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == intent.BatchDeleteIntentsRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_intents_async_from_dict():
+    await test_batch_delete_intents_async(request_type=dict)
+
+
+def test_batch_delete_intents_field_headers():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteIntentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        client.batch_delete_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_intents_field_headers_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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.BatchDeleteIntentsRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/op")
+        )
+
+        await client.batch_delete_intents(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_batch_delete_intents_flattened():
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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.batch_delete_intents(
+            parent="parent_value", intents=[intent.Intent(name="name_value")],
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intents == [intent.Intent(name="name_value")]
+
+
+def test_batch_delete_intents_flattened_error():
+    client = IntentsClient(credentials=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_intents(
+            intent.BatchDeleteIntentsRequest(),
+            parent="parent_value",
+            intents=[intent.Intent(name="name_value")],
+        )
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_intents_flattened_async():
+    client = IntentsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.batch_delete_intents), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = operations_pb2.Operation(name="operations/op")
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            operations_pb2.Operation(name="operations/spam")
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.batch_delete_intents(
+            parent="parent_value", intents=[intent.Intent(name="name_value")],
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].intents == [intent.Intent(name="name_value")]
+
+
+@pytest.mark.asyncio
+async def test_batch_delete_intents_flattened_error_async():
+    client = IntentsAsyncClient(credentials=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_intents(
+            intent.BatchDeleteIntentsRequest(),
+            parent="parent_value",
+            intents=[intent.Intent(name="name_value")],
+        )
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.IntentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = IntentsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.IntentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = IntentsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.IntentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = IntentsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.IntentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = IntentsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.IntentsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.IntentsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.IntentsGrpcTransport, transports.IntentsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = IntentsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.IntentsGrpcTransport,)
+
+
+def test_intents_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.IntentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_intents_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.intents.transports.IntentsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.IntentsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "list_intents",
+        "get_intent",
+        "create_intent",
+        "update_intent",
+        "delete_intent",
+        "batch_update_intents",
+        "batch_delete_intents",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+    # Additionally, the LRO client (a property) should
+    # also raise NotImplementedError
+    with pytest.raises(NotImplementedError):
+        transport.operations_client
+
+
+def test_intents_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.intents.transports.IntentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.IntentsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_intents_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.intents.transports.IntentsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.IntentsTransport()
+        adc.assert_called_once()
+
+
+def test_intents_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        IntentsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_intents_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.IntentsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_intents_host_no_port():
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_intents_host_with_port():
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_intents_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.IntentsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_intents_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.IntentsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.IntentsGrpcTransport, transports.IntentsGrpcAsyncIOTransport],
+)
+def test_intents_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.IntentsGrpcTransport, transports.IntentsGrpcAsyncIOTransport],
+)
+def test_intents_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_intents_grpc_lro_client():
+    client = IntentsClient(
+        credentials=credentials.AnonymousCredentials(), transport="grpc",
+    )
+    transport = client.transport
+
+    # Ensure that we have a api-core operations client.
+    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
+
+
+def test_intents_grpc_lro_async_client():
+    client = IntentsAsyncClient(
+        credentials=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,)
+
+    # Ensure that subsequent calls to the property send the exact same object.
+    assert transport.operations_client is transport.operations_client
+
+
+def test_context_path():
+    project = "squid"
+    session = "clam"
+    context = "whelk"
+
+    expected = "projects/{project}/agent/sessions/{session}/contexts/{context}".format(
+        project=project, session=session, context=context,
+    )
+    actual = IntentsClient.context_path(project, session, context)
+    assert expected == actual
+
+
+def test_parse_context_path():
+    expected = {
+        "project": "octopus",
+        "session": "oyster",
+        "context": "nudibranch",
+    }
+    path = IntentsClient.context_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_context_path(path)
+    assert expected == actual
+
+
+def test_intent_path():
+    project = "cuttlefish"
+    intent = "mussel"
+
+    expected = "projects/{project}/agent/intents/{intent}".format(
+        project=project, intent=intent,
+    )
+    actual = IntentsClient.intent_path(project, intent)
+    assert expected == actual
+
+
+def test_parse_intent_path():
+    expected = {
+        "project": "winkle",
+        "intent": "nautilus",
+    }
+    path = IntentsClient.intent_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_intent_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "scallop"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = IntentsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "abalone",
+    }
+    path = IntentsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "squid"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = IntentsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "clam",
+    }
+    path = IntentsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "whelk"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = IntentsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "octopus",
+    }
+    path = IntentsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "oyster"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = IntentsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "nudibranch",
+    }
+    path = IntentsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "cuttlefish"
+    location = "mussel"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = IntentsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "winkle",
+        "location": "nautilus",
+    }
+    path = IntentsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = IntentsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.IntentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = IntentsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.IntentsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = IntentsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_knowledge_bases.py b/tests/unit/gapic/dialogflow_v2beta1/test_knowledge_bases.py
new file mode 100644
index 000000000..02c8bcbfe
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2beta1/test_knowledge_bases.py
@@ -0,0 +1,2170 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2beta1.services.knowledge_bases import (
+    KnowledgeBasesAsyncClient,
+)
+from google.cloud.dialogflow_v2beta1.services.knowledge_bases import (
+    KnowledgeBasesClient,
+)
+from google.cloud.dialogflow_v2beta1.services.knowledge_bases import pagers
+from google.cloud.dialogflow_v2beta1.services.knowledge_bases import transports
+from google.cloud.dialogflow_v2beta1.types import knowledge_base
+from google.cloud.dialogflow_v2beta1.types import knowledge_base as gcd_knowledge_base
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert KnowledgeBasesClient._get_default_mtls_endpoint(None) is None
+    assert (
+        KnowledgeBasesClient._get_default_mtls_endpoint(api_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        KnowledgeBasesClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        KnowledgeBasesClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        KnowledgeBasesClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        KnowledgeBasesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi
+    )
+
+
+@pytest.mark.parametrize(
+    "client_class", [KnowledgeBasesClient, KnowledgeBasesAsyncClient]
+)
+def test_knowledge_bases_client_from_service_account_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_knowledge_bases_client_get_transport_class():
+    transport = KnowledgeBasesClient.get_transport_class()
+    assert transport == transports.KnowledgeBasesGrpcTransport
+
+    transport = KnowledgeBasesClient.get_transport_class("grpc")
+    assert transport == transports.KnowledgeBasesGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (KnowledgeBasesClient, transports.KnowledgeBasesGrpcTransport, "grpc"),
+        (
+            KnowledgeBasesAsyncClient,
+            transports.KnowledgeBasesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+@mock.patch.object(
+    KnowledgeBasesClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(KnowledgeBasesClient),
+)
+@mock.patch.object(
+    KnowledgeBasesAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(KnowledgeBasesAsyncClient),
+)
+def test_knowledge_bases_client_client_options(
+    client_class, transport_class, transport_name
+):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(KnowledgeBasesClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(KnowledgeBasesClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (KnowledgeBasesClient, transports.KnowledgeBasesGrpcTransport, "grpc", "true"),
+        (
+            KnowledgeBasesAsyncClient,
+            transports.KnowledgeBasesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (KnowledgeBasesClient, transports.KnowledgeBasesGrpcTransport, "grpc", "false"),
+        (
+            KnowledgeBasesAsyncClient,
+            transports.KnowledgeBasesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    KnowledgeBasesClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(KnowledgeBasesClient),
+)
+@mock.patch.object(
+    KnowledgeBasesAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(KnowledgeBasesAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_knowledge_bases_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (KnowledgeBasesClient, transports.KnowledgeBasesGrpcTransport, "grpc"),
+        (
+            KnowledgeBasesAsyncClient,
+            transports.KnowledgeBasesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+def test_knowledge_bases_client_client_options_scopes(
+    client_class, transport_class, transport_name
+):
+    # Check the case scopes are provided.
+    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)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (KnowledgeBasesClient, transports.KnowledgeBasesGrpcTransport, "grpc"),
+        (
+            KnowledgeBasesAsyncClient,
+            transports.KnowledgeBasesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+def test_knowledge_bases_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_knowledge_bases_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.knowledge_bases.transports.KnowledgeBasesGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = KnowledgeBasesClient(
+            client_options={"api_endpoint": "squid.clam.whelk"}
+        )
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_knowledge_bases(
+    transport: str = "grpc", request_type=knowledge_base.ListKnowledgeBasesRequest
+):
+    client = KnowledgeBasesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_knowledge_bases), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = knowledge_base.ListKnowledgeBasesResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_knowledge_bases(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == knowledge_base.ListKnowledgeBasesRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListKnowledgeBasesPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_knowledge_bases_from_dict():
+    test_list_knowledge_bases(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_knowledge_bases_async(
+    transport: str = "grpc_asyncio",
+    request_type=knowledge_base.ListKnowledgeBasesRequest,
+):
+    client = KnowledgeBasesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_knowledge_bases), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            knowledge_base.ListKnowledgeBasesResponse(
+                next_page_token="next_page_token_value",
+            )
+        )
+
+        response = await client.list_knowledge_bases(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == knowledge_base.ListKnowledgeBasesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListKnowledgeBasesAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_knowledge_bases_async_from_dict():
+    await test_list_knowledge_bases_async(request_type=dict)
+
+
+def test_list_knowledge_bases_field_headers():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = knowledge_base.ListKnowledgeBasesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_knowledge_bases), "__call__"
+    ) as call:
+        call.return_value = knowledge_base.ListKnowledgeBasesResponse()
+
+        client.list_knowledge_bases(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_list_knowledge_bases_field_headers_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = knowledge_base.ListKnowledgeBasesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_knowledge_bases), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            knowledge_base.ListKnowledgeBasesResponse()
+        )
+
+        await client.list_knowledge_bases(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_knowledge_bases_flattened():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_knowledge_bases), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = knowledge_base.ListKnowledgeBasesResponse()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.list_knowledge_bases(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_list_knowledge_bases_flattened_error():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.list_knowledge_bases(
+            knowledge_base.ListKnowledgeBasesRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_knowledge_bases_flattened_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_knowledge_bases), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = knowledge_base.ListKnowledgeBasesResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            knowledge_base.ListKnowledgeBasesResponse()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.list_knowledge_bases(parent="parent_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_list_knowledge_bases_flattened_error_async():
+    client = KnowledgeBasesAsyncClient(credentials=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_knowledge_bases(
+            knowledge_base.ListKnowledgeBasesRequest(), parent="parent_value",
+        )
+
+
+def test_list_knowledge_bases_pager():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_knowledge_bases), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                ],
+                next_page_token="abc",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[], next_page_token="def",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[knowledge_base.KnowledgeBase(),],
+                next_page_token="ghi",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                ],
+            ),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_knowledge_bases(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(isinstance(i, knowledge_base.KnowledgeBase) for i in results)
+
+
+def test_list_knowledge_bases_pages():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_knowledge_bases), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                ],
+                next_page_token="abc",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[], next_page_token="def",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[knowledge_base.KnowledgeBase(),],
+                next_page_token="ghi",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                ],
+            ),
+            RuntimeError,
+        )
+        pages = list(client.list_knowledge_bases(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_knowledge_bases_async_pager():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_knowledge_bases),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                ],
+                next_page_token="abc",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[], next_page_token="def",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[knowledge_base.KnowledgeBase(),],
+                next_page_token="ghi",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                ],
+            ),
+            RuntimeError,
+        )
+        async_pager = await client.list_knowledge_bases(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(isinstance(i, knowledge_base.KnowledgeBase) for i in responses)
+
+
+@pytest.mark.asyncio
+async def test_list_knowledge_bases_async_pages():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_knowledge_bases),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                ],
+                next_page_token="abc",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[], next_page_token="def",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[knowledge_base.KnowledgeBase(),],
+                next_page_token="ghi",
+            ),
+            knowledge_base.ListKnowledgeBasesResponse(
+                knowledge_bases=[
+                    knowledge_base.KnowledgeBase(),
+                    knowledge_base.KnowledgeBase(),
+                ],
+            ),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_knowledge_bases(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_get_knowledge_base(
+    transport: str = "grpc", request_type=knowledge_base.GetKnowledgeBaseRequest
+):
+    client = KnowledgeBasesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = knowledge_base.KnowledgeBase(
+            name="name_value",
+            display_name="display_name_value",
+            language_code="language_code_value",
+        )
+
+        response = client.get_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == knowledge_base.GetKnowledgeBaseRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, knowledge_base.KnowledgeBase)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.language_code == "language_code_value"
+
+
+def test_get_knowledge_base_from_dict():
+    test_get_knowledge_base(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_knowledge_base_async(
+    transport: str = "grpc_asyncio", request_type=knowledge_base.GetKnowledgeBaseRequest
+):
+    client = KnowledgeBasesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            knowledge_base.KnowledgeBase(
+                name="name_value",
+                display_name="display_name_value",
+                language_code="language_code_value",
+            )
+        )
+
+        response = await client.get_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == knowledge_base.GetKnowledgeBaseRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, knowledge_base.KnowledgeBase)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_get_knowledge_base_async_from_dict():
+    await test_get_knowledge_base_async(request_type=dict)
+
+
+def test_get_knowledge_base_field_headers():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = knowledge_base.GetKnowledgeBaseRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_knowledge_base), "__call__"
+    ) as call:
+        call.return_value = knowledge_base.KnowledgeBase()
+
+        client.get_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_get_knowledge_base_field_headers_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = knowledge_base.GetKnowledgeBaseRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_knowledge_base), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            knowledge_base.KnowledgeBase()
+        )
+
+        await client.get_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_get_knowledge_base_flattened():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = knowledge_base.KnowledgeBase()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.get_knowledge_base(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_get_knowledge_base_flattened_error():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.get_knowledge_base(
+            knowledge_base.GetKnowledgeBaseRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_knowledge_base_flattened_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = knowledge_base.KnowledgeBase()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            knowledge_base.KnowledgeBase()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.get_knowledge_base(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_get_knowledge_base_flattened_error_async():
+    client = KnowledgeBasesAsyncClient(credentials=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_knowledge_base(
+            knowledge_base.GetKnowledgeBaseRequest(), name="name_value",
+        )
+
+
+def test_create_knowledge_base(
+    transport: str = "grpc", request_type=gcd_knowledge_base.CreateKnowledgeBaseRequest
+):
+    client = KnowledgeBasesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_knowledge_base.KnowledgeBase(
+            name="name_value",
+            display_name="display_name_value",
+            language_code="language_code_value",
+        )
+
+        response = client.create_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_knowledge_base.CreateKnowledgeBaseRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_knowledge_base.KnowledgeBase)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.language_code == "language_code_value"
+
+
+def test_create_knowledge_base_from_dict():
+    test_create_knowledge_base(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_create_knowledge_base_async(
+    transport: str = "grpc_asyncio",
+    request_type=gcd_knowledge_base.CreateKnowledgeBaseRequest,
+):
+    client = KnowledgeBasesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_knowledge_base.KnowledgeBase(
+                name="name_value",
+                display_name="display_name_value",
+                language_code="language_code_value",
+            )
+        )
+
+        response = await client.create_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_knowledge_base.CreateKnowledgeBaseRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_knowledge_base.KnowledgeBase)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_create_knowledge_base_async_from_dict():
+    await test_create_knowledge_base_async(request_type=dict)
+
+
+def test_create_knowledge_base_field_headers():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_knowledge_base.CreateKnowledgeBaseRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_knowledge_base), "__call__"
+    ) as call:
+        call.return_value = gcd_knowledge_base.KnowledgeBase()
+
+        client.create_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_create_knowledge_base_field_headers_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_knowledge_base.CreateKnowledgeBaseRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_knowledge_base), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_knowledge_base.KnowledgeBase()
+        )
+
+        await client.create_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_create_knowledge_base_flattened():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_knowledge_base.KnowledgeBase()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.create_knowledge_base(
+            parent="parent_value",
+            knowledge_base=gcd_knowledge_base.KnowledgeBase(name="name_value"),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].knowledge_base == gcd_knowledge_base.KnowledgeBase(
+            name="name_value"
+        )
+
+
+def test_create_knowledge_base_flattened_error():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.create_knowledge_base(
+            gcd_knowledge_base.CreateKnowledgeBaseRequest(),
+            parent="parent_value",
+            knowledge_base=gcd_knowledge_base.KnowledgeBase(name="name_value"),
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_knowledge_base_flattened_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_knowledge_base.KnowledgeBase()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_knowledge_base.KnowledgeBase()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.create_knowledge_base(
+            parent="parent_value",
+            knowledge_base=gcd_knowledge_base.KnowledgeBase(name="name_value"),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].knowledge_base == gcd_knowledge_base.KnowledgeBase(
+            name="name_value"
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_knowledge_base_flattened_error_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.create_knowledge_base(
+            gcd_knowledge_base.CreateKnowledgeBaseRequest(),
+            parent="parent_value",
+            knowledge_base=gcd_knowledge_base.KnowledgeBase(name="name_value"),
+        )
+
+
+def test_delete_knowledge_base(
+    transport: str = "grpc", request_type=knowledge_base.DeleteKnowledgeBaseRequest
+):
+    client = KnowledgeBasesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == knowledge_base.DeleteKnowledgeBaseRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_knowledge_base_from_dict():
+    test_delete_knowledge_base(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_knowledge_base_async(
+    transport: str = "grpc_asyncio",
+    request_type=knowledge_base.DeleteKnowledgeBaseRequest,
+):
+    client = KnowledgeBasesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == knowledge_base.DeleteKnowledgeBaseRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_knowledge_base_async_from_dict():
+    await test_delete_knowledge_base_async(request_type=dict)
+
+
+def test_delete_knowledge_base_field_headers():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = knowledge_base.DeleteKnowledgeBaseRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_knowledge_base), "__call__"
+    ) as call:
+        call.return_value = None
+
+        client.delete_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_delete_knowledge_base_field_headers_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = knowledge_base.DeleteKnowledgeBaseRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_knowledge_base), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_delete_knowledge_base_flattened():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.delete_knowledge_base(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_delete_knowledge_base_flattened_error():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.delete_knowledge_base(
+            knowledge_base.DeleteKnowledgeBaseRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_knowledge_base_flattened_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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_knowledge_base(name="name_value",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_knowledge_base_flattened_error_async():
+    client = KnowledgeBasesAsyncClient(credentials=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_knowledge_base(
+            knowledge_base.DeleteKnowledgeBaseRequest(), name="name_value",
+        )
+
+
+def test_update_knowledge_base(
+    transport: str = "grpc", request_type=gcd_knowledge_base.UpdateKnowledgeBaseRequest
+):
+    client = KnowledgeBasesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_knowledge_base.KnowledgeBase(
+            name="name_value",
+            display_name="display_name_value",
+            language_code="language_code_value",
+        )
+
+        response = client.update_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_knowledge_base.UpdateKnowledgeBaseRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_knowledge_base.KnowledgeBase)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.language_code == "language_code_value"
+
+
+def test_update_knowledge_base_from_dict():
+    test_update_knowledge_base(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_update_knowledge_base_async(
+    transport: str = "grpc_asyncio",
+    request_type=gcd_knowledge_base.UpdateKnowledgeBaseRequest,
+):
+    client = KnowledgeBasesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_knowledge_base.KnowledgeBase(
+                name="name_value",
+                display_name="display_name_value",
+                language_code="language_code_value",
+            )
+        )
+
+        response = await client.update_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_knowledge_base.UpdateKnowledgeBaseRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_knowledge_base.KnowledgeBase)
+
+    assert response.name == "name_value"
+
+    assert response.display_name == "display_name_value"
+
+    assert response.language_code == "language_code_value"
+
+
+@pytest.mark.asyncio
+async def test_update_knowledge_base_async_from_dict():
+    await test_update_knowledge_base_async(request_type=dict)
+
+
+def test_update_knowledge_base_field_headers():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_knowledge_base.UpdateKnowledgeBaseRequest()
+    request.knowledge_base.name = "knowledge_base.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_knowledge_base), "__call__"
+    ) as call:
+        call.return_value = gcd_knowledge_base.KnowledgeBase()
+
+        client.update_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert (
+        "x-goog-request-params",
+        "knowledge_base.name=knowledge_base.name/value",
+    ) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_update_knowledge_base_field_headers_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_knowledge_base.UpdateKnowledgeBaseRequest()
+    request.knowledge_base.name = "knowledge_base.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_knowledge_base), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_knowledge_base.KnowledgeBase()
+        )
+
+        await client.update_knowledge_base(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert (
+        "x-goog-request-params",
+        "knowledge_base.name=knowledge_base.name/value",
+    ) in kw["metadata"]
+
+
+def test_update_knowledge_base_flattened():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_knowledge_base.KnowledgeBase()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.update_knowledge_base(
+            knowledge_base=gcd_knowledge_base.KnowledgeBase(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].knowledge_base == gcd_knowledge_base.KnowledgeBase(
+            name="name_value"
+        )
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+def test_update_knowledge_base_flattened_error():
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.update_knowledge_base(
+            gcd_knowledge_base.UpdateKnowledgeBaseRequest(),
+            knowledge_base=gcd_knowledge_base.KnowledgeBase(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+@pytest.mark.asyncio
+async def test_update_knowledge_base_flattened_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_knowledge_base), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_knowledge_base.KnowledgeBase()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_knowledge_base.KnowledgeBase()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.update_knowledge_base(
+            knowledge_base=gcd_knowledge_base.KnowledgeBase(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].knowledge_base == gcd_knowledge_base.KnowledgeBase(
+            name="name_value"
+        )
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+@pytest.mark.asyncio
+async def test_update_knowledge_base_flattened_error_async():
+    client = KnowledgeBasesAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.update_knowledge_base(
+            gcd_knowledge_base.UpdateKnowledgeBaseRequest(),
+            knowledge_base=gcd_knowledge_base.KnowledgeBase(name="name_value"),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.KnowledgeBasesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = KnowledgeBasesClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.KnowledgeBasesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = KnowledgeBasesClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.KnowledgeBasesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = KnowledgeBasesClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.KnowledgeBasesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = KnowledgeBasesClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.KnowledgeBasesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.KnowledgeBasesGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [
+        transports.KnowledgeBasesGrpcTransport,
+        transports.KnowledgeBasesGrpcAsyncIOTransport,
+    ],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = KnowledgeBasesClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.KnowledgeBasesGrpcTransport,)
+
+
+def test_knowledge_bases_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.KnowledgeBasesTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_knowledge_bases_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.knowledge_bases.transports.KnowledgeBasesTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.KnowledgeBasesTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "list_knowledge_bases",
+        "get_knowledge_base",
+        "create_knowledge_base",
+        "delete_knowledge_base",
+        "update_knowledge_base",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+
+def test_knowledge_bases_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.knowledge_bases.transports.KnowledgeBasesTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.KnowledgeBasesTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_knowledge_bases_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.knowledge_bases.transports.KnowledgeBasesTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.KnowledgeBasesTransport()
+        adc.assert_called_once()
+
+
+def test_knowledge_bases_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        KnowledgeBasesClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_knowledge_bases_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.KnowledgeBasesGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_knowledge_bases_host_no_port():
+    client = KnowledgeBasesClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_knowledge_bases_host_with_port():
+    client = KnowledgeBasesClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_knowledge_bases_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.KnowledgeBasesGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_knowledge_bases_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.KnowledgeBasesGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [
+        transports.KnowledgeBasesGrpcTransport,
+        transports.KnowledgeBasesGrpcAsyncIOTransport,
+    ],
+)
+def test_knowledge_bases_transport_channel_mtls_with_client_cert_source(
+    transport_class,
+):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [
+        transports.KnowledgeBasesGrpcTransport,
+        transports.KnowledgeBasesGrpcAsyncIOTransport,
+    ],
+)
+def test_knowledge_bases_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_knowledge_base_path():
+    project = "squid"
+    knowledge_base = "clam"
+
+    expected = "projects/{project}/knowledgeBases/{knowledge_base}".format(
+        project=project, knowledge_base=knowledge_base,
+    )
+    actual = KnowledgeBasesClient.knowledge_base_path(project, knowledge_base)
+    assert expected == actual
+
+
+def test_parse_knowledge_base_path():
+    expected = {
+        "project": "whelk",
+        "knowledge_base": "octopus",
+    }
+    path = KnowledgeBasesClient.knowledge_base_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = KnowledgeBasesClient.parse_knowledge_base_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "oyster"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = KnowledgeBasesClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "nudibranch",
+    }
+    path = KnowledgeBasesClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = KnowledgeBasesClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "cuttlefish"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = KnowledgeBasesClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "mussel",
+    }
+    path = KnowledgeBasesClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = KnowledgeBasesClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "winkle"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = KnowledgeBasesClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "nautilus",
+    }
+    path = KnowledgeBasesClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = KnowledgeBasesClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "scallop"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = KnowledgeBasesClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "abalone",
+    }
+    path = KnowledgeBasesClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = KnowledgeBasesClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "squid"
+    location = "clam"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = KnowledgeBasesClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "whelk",
+        "location": "octopus",
+    }
+    path = KnowledgeBasesClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = KnowledgeBasesClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.KnowledgeBasesTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = KnowledgeBasesClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.KnowledgeBasesTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = KnowledgeBasesClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_session_entity_types.py b/tests/unit/gapic/dialogflow_v2beta1/test_session_entity_types.py
new file mode 100644
index 000000000..da964e3ce
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2beta1/test_session_entity_types.py
@@ -0,0 +1,2248 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2beta1.services.session_entity_types import (
+    SessionEntityTypesAsyncClient,
+)
+from google.cloud.dialogflow_v2beta1.services.session_entity_types import (
+    SessionEntityTypesClient,
+)
+from google.cloud.dialogflow_v2beta1.services.session_entity_types import pagers
+from google.cloud.dialogflow_v2beta1.services.session_entity_types import transports
+from google.cloud.dialogflow_v2beta1.types import entity_type
+from google.cloud.dialogflow_v2beta1.types import session_entity_type
+from google.cloud.dialogflow_v2beta1.types import (
+    session_entity_type as gcd_session_entity_type,
+)
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert SessionEntityTypesClient._get_default_mtls_endpoint(None) is None
+    assert (
+        SessionEntityTypesClient._get_default_mtls_endpoint(api_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        SessionEntityTypesClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        SessionEntityTypesClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        SessionEntityTypesClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        SessionEntityTypesClient._get_default_mtls_endpoint(non_googleapi)
+        == non_googleapi
+    )
+
+
+@pytest.mark.parametrize(
+    "client_class", [SessionEntityTypesClient, SessionEntityTypesAsyncClient]
+)
+def test_session_entity_types_client_from_service_account_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_session_entity_types_client_get_transport_class():
+    transport = SessionEntityTypesClient.get_transport_class()
+    assert transport == transports.SessionEntityTypesGrpcTransport
+
+    transport = SessionEntityTypesClient.get_transport_class("grpc")
+    assert transport == transports.SessionEntityTypesGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionEntityTypesClient, transports.SessionEntityTypesGrpcTransport, "grpc"),
+        (
+            SessionEntityTypesAsyncClient,
+            transports.SessionEntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+@mock.patch.object(
+    SessionEntityTypesClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionEntityTypesClient),
+)
+@mock.patch.object(
+    SessionEntityTypesAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionEntityTypesAsyncClient),
+)
+def test_session_entity_types_client_client_options(
+    client_class, transport_class, transport_name
+):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(SessionEntityTypesClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(SessionEntityTypesClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (
+            SessionEntityTypesClient,
+            transports.SessionEntityTypesGrpcTransport,
+            "grpc",
+            "true",
+        ),
+        (
+            SessionEntityTypesAsyncClient,
+            transports.SessionEntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (
+            SessionEntityTypesClient,
+            transports.SessionEntityTypesGrpcTransport,
+            "grpc",
+            "false",
+        ),
+        (
+            SessionEntityTypesAsyncClient,
+            transports.SessionEntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    SessionEntityTypesClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionEntityTypesClient),
+)
+@mock.patch.object(
+    SessionEntityTypesAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionEntityTypesAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_session_entity_types_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionEntityTypesClient, transports.SessionEntityTypesGrpcTransport, "grpc"),
+        (
+            SessionEntityTypesAsyncClient,
+            transports.SessionEntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionEntityTypesClient, transports.SessionEntityTypesGrpcTransport, "grpc"),
+        (
+            SessionEntityTypesAsyncClient,
+            transports.SessionEntityTypesGrpcAsyncIOTransport,
+            "grpc_asyncio",
+        ),
+    ],
+)
+def test_session_entity_types_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_session_entity_types_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.session_entity_types.transports.SessionEntityTypesGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = SessionEntityTypesClient(
+            client_options={"api_endpoint": "squid.clam.whelk"}
+        )
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_list_session_entity_types(
+    transport: str = "grpc",
+    request_type=session_entity_type.ListSessionEntityTypesRequest,
+):
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = session_entity_type.ListSessionEntityTypesResponse(
+            next_page_token="next_page_token_value",
+        )
+
+        response = client.list_session_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.ListSessionEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, pagers.ListSessionEntityTypesPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+def test_list_session_entity_types_from_dict():
+    test_list_session_entity_types(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_async(
+    transport: str = "grpc_asyncio",
+    request_type=session_entity_type.ListSessionEntityTypesRequest,
+):
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.ListSessionEntityTypesResponse(
+                next_page_token="next_page_token_value",
+            )
+        )
+
+        response = await client.list_session_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.ListSessionEntityTypesRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, pagers.ListSessionEntityTypesAsyncPager)
+
+    assert response.next_page_token == "next_page_token_value"
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_async_from_dict():
+    await test_list_session_entity_types_async(request_type=dict)
+
+
+def test_list_session_entity_types_field_headers():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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_entity_type.ListSessionEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        call.return_value = session_entity_type.ListSessionEntityTypesResponse()
+
+        client.list_session_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_field_headers_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Any value 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_entity_type.ListSessionEntityTypesRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.ListSessionEntityTypesResponse()
+        )
+
+        await client.list_session_entity_types(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_list_session_entity_types_flattened():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+def test_list_session_entity_types_flattened_error():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.list_session_entity_types(
+            session_entity_type.ListSessionEntityTypesRequest(), parent="parent_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_flattened_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = session_entity_type.ListSessionEntityTypesResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.ListSessionEntityTypesResponse()
+        )
+        # 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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_flattened_error_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=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_session_entity_types(
+            session_entity_type.ListSessionEntityTypesRequest(), parent="parent_value",
+        )
+
+
+def test_list_session_entity_types_pager():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[], next_page_token="def",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[session_entity_type.SessionEntityType(),],
+                next_page_token="ghi",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+            ),
+            RuntimeError,
+        )
+
+        metadata = ()
+        metadata = tuple(metadata) + (
+            gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
+        )
+        pager = client.list_session_entity_types(request={})
+
+        assert pager._metadata == metadata
+
+        results = [i for i in pager]
+        assert len(results) == 6
+        assert all(
+            isinstance(i, session_entity_type.SessionEntityType) for i in results
+        )
+
+
+def test_list_session_entity_types_pages():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials,)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types), "__call__"
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[], next_page_token="def",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[session_entity_type.SessionEntityType(),],
+                next_page_token="ghi",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+            ),
+            RuntimeError,
+        )
+        pages = list(client.list_session_entity_types(request={}).pages)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_async_pager():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials,
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[], next_page_token="def",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[session_entity_type.SessionEntityType(),],
+                next_page_token="ghi",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+            ),
+            RuntimeError,
+        )
+        async_pager = await client.list_session_entity_types(request={},)
+        assert async_pager.next_page_token == "abc"
+        responses = []
+        async for response in async_pager:
+            responses.append(response)
+
+        assert len(responses) == 6
+        assert all(
+            isinstance(i, session_entity_type.SessionEntityType) for i in responses
+        )
+
+
+@pytest.mark.asyncio
+async def test_list_session_entity_types_async_pages():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials,
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.list_session_entity_types),
+        "__call__",
+        new_callable=mock.AsyncMock,
+    ) as call:
+        # Set the response to a series of pages.
+        call.side_effect = (
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+                next_page_token="abc",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[], next_page_token="def",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[session_entity_type.SessionEntityType(),],
+                next_page_token="ghi",
+            ),
+            session_entity_type.ListSessionEntityTypesResponse(
+                session_entity_types=[
+                    session_entity_type.SessionEntityType(),
+                    session_entity_type.SessionEntityType(),
+                ],
+            ),
+            RuntimeError,
+        )
+        pages = []
+        async for page_ in (await client.list_session_entity_types(request={})).pages:
+            pages.append(page_)
+        for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
+            assert page_.raw_page.next_page_token == token
+
+
+def test_get_session_entity_type(
+    transport: str = "grpc",
+    request_type=session_entity_type.GetSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = session_entity_type.SessionEntityType(
+            name="name_value",
+            entity_override_mode=session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+        )
+
+        response = client.get_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.GetSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+def test_get_session_entity_type_from_dict():
+    test_get_session_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_get_session_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=session_entity_type.GetSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.SessionEntityType(
+                name="name_value",
+                entity_override_mode=session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+            )
+        )
+
+        response = await client.get_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.GetSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+@pytest.mark.asyncio
+async def test_get_session_entity_type_async_from_dict():
+    await test_get_session_entity_type_async(request_type=dict)
+
+
+def test_get_session_entity_type_field_headers():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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_entity_type.GetSessionEntityTypeRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = session_entity_type.SessionEntityType()
+
+        client.get_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_get_session_entity_type_field_headers_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Any value 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_entity_type.GetSessionEntityTypeRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.SessionEntityType()
+        )
+
+        await client.get_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_get_session_entity_type_flattened():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_get_session_entity_type_flattened_error():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.get_session_entity_type(
+            session_entity_type.GetSessionEntityTypeRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_get_session_entity_type_flattened_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.get_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = session_entity_type.SessionEntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            session_entity_type.SessionEntityType()
+        )
+        # 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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_get_session_entity_type_flattened_error_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=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_session_entity_type(
+            session_entity_type.GetSessionEntityTypeRequest(), name="name_value",
+        )
+
+
+def test_create_session_entity_type(
+    transport: str = "grpc",
+    request_type=gcd_session_entity_type.CreateSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType(
+            name="name_value",
+            entity_override_mode=gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+        )
+
+        response = client.create_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session_entity_type.CreateSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+def test_create_session_entity_type_from_dict():
+    test_create_session_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_create_session_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=gcd_session_entity_type.CreateSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType(
+                name="name_value",
+                entity_override_mode=gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+            )
+        )
+
+        response = await client.create_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session_entity_type.CreateSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+@pytest.mark.asyncio
+async def test_create_session_entity_type_async_from_dict():
+    await test_create_session_entity_type_async(request_type=dict)
+
+
+def test_create_session_entity_type_field_headers():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session_entity_type.CreateSessionEntityTypeRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        client.create_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_create_session_entity_type_field_headers_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session_entity_type.CreateSessionEntityTypeRequest()
+    request.parent = "parent/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType()
+        )
+
+        await client.create_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+
+
+def test_create_session_entity_type_flattened():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.create_session_entity_type(
+            parent="parent_value",
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].session_entity_type == gcd_session_entity_type.SessionEntityType(
+            name="name_value"
+        )
+
+
+def test_create_session_entity_type_flattened_error():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.create_session_entity_type(
+            gcd_session_entity_type.CreateSessionEntityTypeRequest(),
+            parent="parent_value",
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_session_entity_type_flattened_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.create_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.create_session_entity_type(
+            parent="parent_value",
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].parent == "parent_value"
+
+        assert args[0].session_entity_type == gcd_session_entity_type.SessionEntityType(
+            name="name_value"
+        )
+
+
+@pytest.mark.asyncio
+async def test_create_session_entity_type_flattened_error_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.create_session_entity_type(
+            gcd_session_entity_type.CreateSessionEntityTypeRequest(),
+            parent="parent_value",
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+        )
+
+
+def test_update_session_entity_type(
+    transport: str = "grpc",
+    request_type=gcd_session_entity_type.UpdateSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType(
+            name="name_value",
+            entity_override_mode=gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+        )
+
+        response = client.update_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session_entity_type.UpdateSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+def test_update_session_entity_type_from_dict():
+    test_update_session_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_update_session_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=gcd_session_entity_type.UpdateSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType(
+                name="name_value",
+                entity_override_mode=gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE,
+            )
+        )
+
+        response = await client.update_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session_entity_type.UpdateSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_session_entity_type.SessionEntityType)
+
+    assert response.name == "name_value"
+
+    assert (
+        response.entity_override_mode
+        == gcd_session_entity_type.SessionEntityType.EntityOverrideMode.ENTITY_OVERRIDE_MODE_OVERRIDE
+    )
+
+
+@pytest.mark.asyncio
+async def test_update_session_entity_type_async_from_dict():
+    await test_update_session_entity_type_async(request_type=dict)
+
+
+def test_update_session_entity_type_field_headers():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session_entity_type.UpdateSessionEntityTypeRequest()
+    request.session_entity_type.name = "session_entity_type.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        client.update_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert (
+        "x-goog-request-params",
+        "session_entity_type.name=session_entity_type.name/value",
+    ) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_update_session_entity_type_field_headers_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session_entity_type.UpdateSessionEntityTypeRequest()
+    request.session_entity_type.name = "session_entity_type.name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType()
+        )
+
+        await client.update_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert (
+        "x-goog-request-params",
+        "session_entity_type.name=session_entity_type.name/value",
+    ) in kw["metadata"]
+
+
+def test_update_session_entity_type_flattened():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.update_session_entity_type(
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].session_entity_type == gcd_session_entity_type.SessionEntityType(
+            name="name_value"
+        )
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+def test_update_session_entity_type_flattened_error():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.update_session_entity_type(
+            gcd_session_entity_type.UpdateSessionEntityTypeRequest(),
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+@pytest.mark.asyncio
+async def test_update_session_entity_type_flattened_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.update_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session_entity_type.SessionEntityType()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session_entity_type.SessionEntityType()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.update_session_entity_type(
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].session_entity_type == gcd_session_entity_type.SessionEntityType(
+            name="name_value"
+        )
+
+        assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+
+
+@pytest.mark.asyncio
+async def test_update_session_entity_type_flattened_error_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.update_session_entity_type(
+            gcd_session_entity_type.UpdateSessionEntityTypeRequest(),
+            session_entity_type=gcd_session_entity_type.SessionEntityType(
+                name="name_value"
+            ),
+            update_mask=field_mask.FieldMask(paths=["paths_value"]),
+        )
+
+
+def test_delete_session_entity_type(
+    transport: str = "grpc",
+    request_type=session_entity_type.DeleteSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        response = client.delete_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.DeleteSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+def test_delete_session_entity_type_from_dict():
+    test_delete_session_entity_type(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_delete_session_entity_type_async(
+    transport: str = "grpc_asyncio",
+    request_type=session_entity_type.DeleteSessionEntityTypeRequest,
+):
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        response = await client.delete_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == session_entity_type.DeleteSessionEntityTypeRequest()
+
+    # Establish that the response is the type that we expect.
+    assert response is None
+
+
+@pytest.mark.asyncio
+async def test_delete_session_entity_type_async_from_dict():
+    await test_delete_session_entity_type_async(request_type=dict)
+
+
+def test_delete_session_entity_type_field_headers():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value 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_entity_type.DeleteSessionEntityTypeRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = None
+
+        client.delete_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_delete_session_entity_type_field_headers_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Any value 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_entity_type.DeleteSessionEntityTypeRequest()
+    request.name = "name/value"
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
+
+        await client.delete_session_entity_type(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+
+
+def test_delete_session_entity_type_flattened():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+def test_delete_session_entity_type_flattened_error():
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.delete_session_entity_type(
+            session_entity_type.DeleteSessionEntityTypeRequest(), name="name_value",
+        )
+
+
+@pytest.mark.asyncio
+async def test_delete_session_entity_type_flattened_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=credentials.AnonymousCredentials(),
+    )
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.delete_session_entity_type), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = None
+
+        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",)
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].name == "name_value"
+
+
+@pytest.mark.asyncio
+async def test_delete_session_entity_type_flattened_error_async():
+    client = SessionEntityTypesAsyncClient(
+        credentials=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_session_entity_type(
+            session_entity_type.DeleteSessionEntityTypeRequest(), name="name_value",
+        )
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionEntityTypesClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionEntityTypesClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionEntityTypesClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = SessionEntityTypesClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.SessionEntityTypesGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [
+        transports.SessionEntityTypesGrpcTransport,
+        transports.SessionEntityTypesGrpcAsyncIOTransport,
+    ],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = SessionEntityTypesClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.SessionEntityTypesGrpcTransport,)
+
+
+def test_session_entity_types_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.SessionEntityTypesTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_session_entity_types_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.session_entity_types.transports.SessionEntityTypesTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.SessionEntityTypesTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "list_session_entity_types",
+        "get_session_entity_type",
+        "create_session_entity_type",
+        "update_session_entity_type",
+        "delete_session_entity_type",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+
+def test_session_entity_types_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.session_entity_types.transports.SessionEntityTypesTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.SessionEntityTypesTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_session_entity_types_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.session_entity_types.transports.SessionEntityTypesTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.SessionEntityTypesTransport()
+        adc.assert_called_once()
+
+
+def test_session_entity_types_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        SessionEntityTypesClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_session_entity_types_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.SessionEntityTypesGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_session_entity_types_host_no_port():
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_session_entity_types_host_with_port():
+    client = SessionEntityTypesClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_session_entity_types_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.SessionEntityTypesGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_session_entity_types_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.SessionEntityTypesGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [
+        transports.SessionEntityTypesGrpcTransport,
+        transports.SessionEntityTypesGrpcAsyncIOTransport,
+    ],
+)
+def test_session_entity_types_transport_channel_mtls_with_client_cert_source(
+    transport_class,
+):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [
+        transports.SessionEntityTypesGrpcTransport,
+        transports.SessionEntityTypesGrpcAsyncIOTransport,
+    ],
+)
+def test_session_entity_types_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_session_entity_type_path():
+    project = "squid"
+    session = "clam"
+    entity_type = "whelk"
+
+    expected = "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}".format(
+        project=project, session=session, entity_type=entity_type,
+    )
+    actual = SessionEntityTypesClient.session_entity_type_path(
+        project, session, entity_type
+    )
+    assert expected == actual
+
+
+def test_parse_session_entity_type_path():
+    expected = {
+        "project": "octopus",
+        "session": "oyster",
+        "entity_type": "nudibranch",
+    }
+    path = SessionEntityTypesClient.session_entity_type_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_session_entity_type_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "cuttlefish"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = SessionEntityTypesClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "mussel",
+    }
+    path = SessionEntityTypesClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "winkle"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = SessionEntityTypesClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "nautilus",
+    }
+    path = SessionEntityTypesClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "scallop"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = SessionEntityTypesClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "abalone",
+    }
+    path = SessionEntityTypesClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "squid"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = SessionEntityTypesClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "clam",
+    }
+    path = SessionEntityTypesClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "whelk"
+    location = "octopus"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = SessionEntityTypesClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "oyster",
+        "location": "nudibranch",
+    }
+    path = SessionEntityTypesClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionEntityTypesClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.SessionEntityTypesTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = SessionEntityTypesClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.SessionEntityTypesTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = SessionEntityTypesClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_sessions.py b/tests/unit/gapic/dialogflow_v2beta1/test_sessions.py
new file mode 100644
index 000000000..289963a61
--- /dev/null
+++ b/tests/unit/gapic/dialogflow_v2beta1/test_sessions.py
@@ -0,0 +1,1274 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2020 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.
+#
+
+import os
+import mock
+
+import grpc
+from grpc.experimental import aio
+import math
+import pytest
+from proto.marshal.rules.dates import DurationRule, TimestampRule
+
+from google import auth
+from google.api_core import client_options
+from google.api_core import exceptions
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers
+from google.api_core import grpc_helpers_async
+from google.auth import credentials
+from google.auth.exceptions import MutualTLSChannelError
+from google.cloud.dialogflow_v2beta1.services.sessions import SessionsAsyncClient
+from google.cloud.dialogflow_v2beta1.services.sessions import SessionsClient
+from google.cloud.dialogflow_v2beta1.services.sessions import transports
+from google.cloud.dialogflow_v2beta1.types import agent
+from google.cloud.dialogflow_v2beta1.types import audio_config
+from google.cloud.dialogflow_v2beta1.types import context
+from google.cloud.dialogflow_v2beta1.types import entity_type
+from google.cloud.dialogflow_v2beta1.types import session
+from google.cloud.dialogflow_v2beta1.types import session as gcd_session
+from google.cloud.dialogflow_v2beta1.types import session_entity_type
+from google.oauth2 import service_account
+from google.protobuf import field_mask_pb2 as field_mask  # type: ignore
+from google.protobuf import struct_pb2 as struct  # type: ignore
+from google.rpc import status_pb2 as status  # type: ignore
+from google.type import latlng_pb2 as latlng  # type: ignore
+
+
+def client_cert_source_callback():
+    return b"cert bytes", b"key bytes"
+
+
+# If default endpoint is localhost, then default mtls endpoint will be the same.
+# This method modifies the default endpoint so the client can produce a different
+# mtls endpoint for endpoint testing purposes.
+def modify_default_endpoint(client):
+    return (
+        "foo.googleapis.com"
+        if ("localhost" in client.DEFAULT_ENDPOINT)
+        else client.DEFAULT_ENDPOINT
+    )
+
+
+def test__get_default_mtls_endpoint():
+    api_endpoint = "example.googleapis.com"
+    api_mtls_endpoint = "example.mtls.googleapis.com"
+    sandbox_endpoint = "example.sandbox.googleapis.com"
+    sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
+    non_googleapi = "api.example.com"
+
+    assert SessionsClient._get_default_mtls_endpoint(None) is None
+    assert SessionsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint
+    assert (
+        SessionsClient._get_default_mtls_endpoint(api_mtls_endpoint)
+        == api_mtls_endpoint
+    )
+    assert (
+        SessionsClient._get_default_mtls_endpoint(sandbox_endpoint)
+        == sandbox_mtls_endpoint
+    )
+    assert (
+        SessionsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint)
+        == sandbox_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_file(client_class):
+    creds = 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")
+        assert client.transport._credentials == creds
+
+        client = client_class.from_service_account_json("dummy/file/path.json")
+        assert client.transport._credentials == creds
+
+        assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_sessions_client_get_transport_class():
+    transport = SessionsClient.get_transport_class()
+    assert transport == transports.SessionsGrpcTransport
+
+    transport = SessionsClient.get_transport_class("grpc")
+    assert transport == transports.SessionsGrpcTransport
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionsClient, transports.SessionsGrpcTransport, "grpc"),
+        (SessionsAsyncClient, transports.SessionsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+@mock.patch.object(
+    SessionsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SessionsClient)
+)
+@mock.patch.object(
+    SessionsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionsAsyncClient),
+)
+def test_sessions_client_client_options(client_class, transport_class, transport_name):
+    # Check that if channel is provided we won't create a new one.
+    with mock.patch.object(SessionsClient, "get_transport_class") as gtc:
+        transport = transport_class(credentials=credentials.AnonymousCredentials())
+        client = client_class(transport=transport)
+        gtc.assert_not_called()
+
+    # Check that if channel is provided via str we will create a new one.
+    with mock.patch.object(SessionsClient, "get_transport_class") as gtc:
+        client = client_class(transport=transport_name)
+        gtc.assert_called()
+
+    # Check the case api_endpoint is provided.
+    options = client_options.ClientOptions(api_endpoint="squid.clam.whelk")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "never".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
+    # "always".
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            patched.return_value = None
+            client = client_class()
+            patched.assert_called_once_with(
+                credentials=None,
+                credentials_file=None,
+                host=client.DEFAULT_MTLS_ENDPOINT,
+                scopes=None,
+                ssl_channel_credentials=None,
+                quota_project_id=None,
+                client_info=transports.base.DEFAULT_CLIENT_INFO,
+            )
+
+    # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
+    # unsupported value.
+    with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
+        with pytest.raises(MutualTLSChannelError):
+            client = client_class()
+
+    # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
+    ):
+        with pytest.raises(ValueError):
+            client = client_class()
+
+    # Check the case quota_project_id is provided
+    options = client_options.ClientOptions(quota_project_id="octopus")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id="octopus",
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name,use_client_cert_env",
+    [
+        (SessionsClient, transports.SessionsGrpcTransport, "grpc", "true"),
+        (
+            SessionsAsyncClient,
+            transports.SessionsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "true",
+        ),
+        (SessionsClient, transports.SessionsGrpcTransport, "grpc", "false"),
+        (
+            SessionsAsyncClient,
+            transports.SessionsGrpcAsyncIOTransport,
+            "grpc_asyncio",
+            "false",
+        ),
+    ],
+)
+@mock.patch.object(
+    SessionsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SessionsClient)
+)
+@mock.patch.object(
+    SessionsAsyncClient,
+    "DEFAULT_ENDPOINT",
+    modify_default_endpoint(SessionsAsyncClient),
+)
+@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"})
+def test_sessions_client_mtls_env_auto(
+    client_class, transport_class, transport_name, use_client_cert_env
+):
+    # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default
+    # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists.
+
+    # Check the case client_cert_source is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        options = client_options.ClientOptions(
+            client_cert_source=client_cert_source_callback
+        )
+        with mock.patch.object(transport_class, "__init__") as patched:
+            ssl_channel_creds = mock.Mock()
+            with mock.patch(
+                "grpc.ssl_channel_credentials", return_value=ssl_channel_creds
+            ):
+                patched.return_value = None
+                client = client_class(client_options=options)
+
+                if use_client_cert_env == "false":
+                    expected_ssl_channel_creds = None
+                    expected_host = client.DEFAULT_ENDPOINT
+                else:
+                    expected_ssl_channel_creds = ssl_channel_creds
+                    expected_host = client.DEFAULT_MTLS_ENDPOINT
+
+                patched.assert_called_once_with(
+                    credentials=None,
+                    credentials_file=None,
+                    host=expected_host,
+                    scopes=None,
+                    ssl_channel_credentials=expected_ssl_channel_creds,
+                    quota_project_id=None,
+                    client_info=transports.base.DEFAULT_CLIENT_INFO,
+                )
+
+    # Check the case ADC client cert is provided. Whether client cert is used depends on
+    # GOOGLE_API_USE_CLIENT_CERTIFICATE value.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    with mock.patch(
+                        "google.auth.transport.grpc.SslCredentials.ssl_credentials",
+                        new_callable=mock.PropertyMock,
+                    ) as ssl_credentials_mock:
+                        if use_client_cert_env == "false":
+                            is_mtls_mock.return_value = False
+                            ssl_credentials_mock.return_value = None
+                            expected_host = client.DEFAULT_ENDPOINT
+                            expected_ssl_channel_creds = None
+                        else:
+                            is_mtls_mock.return_value = True
+                            ssl_credentials_mock.return_value = mock.Mock()
+                            expected_host = client.DEFAULT_MTLS_ENDPOINT
+                            expected_ssl_channel_creds = (
+                                ssl_credentials_mock.return_value
+                            )
+
+                        patched.return_value = None
+                        client = client_class()
+                        patched.assert_called_once_with(
+                            credentials=None,
+                            credentials_file=None,
+                            host=expected_host,
+                            scopes=None,
+                            ssl_channel_credentials=expected_ssl_channel_creds,
+                            quota_project_id=None,
+                            client_info=transports.base.DEFAULT_CLIENT_INFO,
+                        )
+
+    # Check the case client_cert_source and ADC client cert are not provided.
+    with mock.patch.dict(
+        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}
+    ):
+        with mock.patch.object(transport_class, "__init__") as patched:
+            with mock.patch(
+                "google.auth.transport.grpc.SslCredentials.__init__", return_value=None
+            ):
+                with mock.patch(
+                    "google.auth.transport.grpc.SslCredentials.is_mtls",
+                    new_callable=mock.PropertyMock,
+                ) as is_mtls_mock:
+                    is_mtls_mock.return_value = False
+                    patched.return_value = None
+                    client = client_class()
+                    patched.assert_called_once_with(
+                        credentials=None,
+                        credentials_file=None,
+                        host=client.DEFAULT_ENDPOINT,
+                        scopes=None,
+                        ssl_channel_credentials=None,
+                        quota_project_id=None,
+                        client_info=transports.base.DEFAULT_CLIENT_INFO,
+                    )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionsClient, transports.SessionsGrpcTransport, "grpc"),
+        (SessionsAsyncClient, transports.SessionsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+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"],)
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host=client.DEFAULT_ENDPOINT,
+            scopes=["1", "2"],
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+@pytest.mark.parametrize(
+    "client_class,transport_class,transport_name",
+    [
+        (SessionsClient, transports.SessionsGrpcTransport, "grpc"),
+        (SessionsAsyncClient, transports.SessionsGrpcAsyncIOTransport, "grpc_asyncio"),
+    ],
+)
+def test_sessions_client_client_options_credentials_file(
+    client_class, transport_class, transport_name
+):
+    # Check the case credentials file is provided.
+    options = client_options.ClientOptions(credentials_file="credentials.json")
+    with mock.patch.object(transport_class, "__init__") as patched:
+        patched.return_value = None
+        client = client_class(client_options=options)
+        patched.assert_called_once_with(
+            credentials=None,
+            credentials_file="credentials.json",
+            host=client.DEFAULT_ENDPOINT,
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_sessions_client_client_options_from_dict():
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.sessions.transports.SessionsGrpcTransport.__init__"
+    ) as grpc_transport:
+        grpc_transport.return_value = None
+        client = SessionsClient(client_options={"api_endpoint": "squid.clam.whelk"})
+        grpc_transport.assert_called_once_with(
+            credentials=None,
+            credentials_file=None,
+            host="squid.clam.whelk",
+            scopes=None,
+            ssl_channel_credentials=None,
+            quota_project_id=None,
+            client_info=transports.base.DEFAULT_CLIENT_INFO,
+        )
+
+
+def test_detect_intent(
+    transport: str = "grpc", request_type=gcd_session.DetectIntentRequest
+):
+    client = SessionsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.detect_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session.DetectIntentResponse(
+            response_id="response_id_value", output_audio=b"output_audio_blob",
+        )
+
+        response = client.detect_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session.DetectIntentRequest()
+
+    # Establish that the response is the type that we expect.
+
+    assert isinstance(response, gcd_session.DetectIntentResponse)
+
+    assert response.response_id == "response_id_value"
+
+    assert response.output_audio == b"output_audio_blob"
+
+
+def test_detect_intent_from_dict():
+    test_detect_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_detect_intent_async(
+    transport: str = "grpc_asyncio", request_type=gcd_session.DetectIntentRequest
+):
+    client = SessionsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.detect_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session.DetectIntentResponse(
+                response_id="response_id_value", output_audio=b"output_audio_blob",
+            )
+        )
+
+        response = await client.detect_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0] == gcd_session.DetectIntentRequest()
+
+    # Establish that the response is the type that we expect.
+    assert isinstance(response, gcd_session.DetectIntentResponse)
+
+    assert response.response_id == "response_id_value"
+
+    assert response.output_audio == b"output_audio_blob"
+
+
+@pytest.mark.asyncio
+async def test_detect_intent_async_from_dict():
+    await test_detect_intent_async(request_type=dict)
+
+
+def test_detect_intent_field_headers():
+    client = SessionsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session.DetectIntentRequest()
+    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:
+        call.return_value = gcd_session.DetectIntentResponse()
+
+        client.detect_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    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=credentials.AnonymousCredentials(),)
+
+    # Any value that is part of the HTTP/1.1 URI should be sent as
+    # a field header. Set these to a non-empty value.
+    request = gcd_session.DetectIntentRequest()
+    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:
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session.DetectIntentResponse()
+        )
+
+        await client.detect_intent(request)
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+        assert args[0] == request
+
+    # Establish that the field header was sent.
+    _, _, kw = call.mock_calls[0]
+    assert ("x-goog-request-params", "session=session/value",) in kw["metadata"]
+
+
+def test_detect_intent_flattened():
+    client = SessionsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.detect_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session.DetectIntentResponse()
+
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        client.detect_intent(
+            session="session_value",
+            query_input=gcd_session.QueryInput(
+                audio_config=audio_config.InputAudioConfig(
+                    audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+                )
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].session == "session_value"
+
+        assert args[0].query_input == gcd_session.QueryInput(
+            audio_config=audio_config.InputAudioConfig(
+                audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+            )
+        )
+
+
+def test_detect_intent_flattened_error():
+    client = SessionsClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        client.detect_intent(
+            gcd_session.DetectIntentRequest(),
+            session="session_value",
+            query_input=gcd_session.QueryInput(
+                audio_config=audio_config.InputAudioConfig(
+                    audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+                )
+            ),
+        )
+
+
+@pytest.mark.asyncio
+async def test_detect_intent_flattened_async():
+    client = SessionsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(type(client.transport.detect_intent), "__call__") as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = gcd_session.DetectIntentResponse()
+
+        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+            gcd_session.DetectIntentResponse()
+        )
+        # Call the method with a truthy value for each flattened field,
+        # using the keyword arguments to the method.
+        response = await client.detect_intent(
+            session="session_value",
+            query_input=gcd_session.QueryInput(
+                audio_config=audio_config.InputAudioConfig(
+                    audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+                )
+            ),
+        )
+
+        # Establish that the underlying call was made with the expected
+        # request object values.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert args[0].session == "session_value"
+
+        assert args[0].query_input == gcd_session.QueryInput(
+            audio_config=audio_config.InputAudioConfig(
+                audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+            )
+        )
+
+
+@pytest.mark.asyncio
+async def test_detect_intent_flattened_error_async():
+    client = SessionsAsyncClient(credentials=credentials.AnonymousCredentials(),)
+
+    # Attempting to call a method with both a request object and flattened
+    # fields is an error.
+    with pytest.raises(ValueError):
+        await client.detect_intent(
+            gcd_session.DetectIntentRequest(),
+            session="session_value",
+            query_input=gcd_session.QueryInput(
+                audio_config=audio_config.InputAudioConfig(
+                    audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16
+                )
+            ),
+        )
+
+
+def test_streaming_detect_intent(
+    transport: str = "grpc", request_type=session.StreamingDetectIntentRequest
+):
+    client = SessionsClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    requests = [request]
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.streaming_detect_intent), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = iter([session.StreamingDetectIntentResponse()])
+
+        response = client.streaming_detect_intent(iter(requests))
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls) == 1
+        _, args, _ = call.mock_calls[0]
+
+        assert next(args[0]) == request
+
+    # Establish that the response is the type that we expect.
+    for message in response:
+        assert isinstance(message, session.StreamingDetectIntentResponse)
+
+
+def test_streaming_detect_intent_from_dict():
+    test_streaming_detect_intent(request_type=dict)
+
+
+@pytest.mark.asyncio
+async def test_streaming_detect_intent_async(
+    transport: str = "grpc_asyncio", request_type=session.StreamingDetectIntentRequest
+):
+    client = SessionsAsyncClient(
+        credentials=credentials.AnonymousCredentials(), transport=transport,
+    )
+
+    # Everything is optional in proto3 as far as the runtime is concerned,
+    # and we are mocking out the actual API, so just send an empty request.
+    request = request_type()
+
+    requests = [request]
+
+    # Mock the actual call within the gRPC stub, and fake the request.
+    with mock.patch.object(
+        type(client.transport.streaming_detect_intent), "__call__"
+    ) as call:
+        # Designate an appropriate return value for the call.
+        call.return_value = mock.Mock(aio.StreamStreamCall, autospec=True)
+        call.return_value.read = mock.AsyncMock(
+            side_effect=[session.StreamingDetectIntentResponse()]
+        )
+
+        response = await client.streaming_detect_intent(iter(requests))
+
+        # Establish that the underlying gRPC stub method was called.
+        assert len(call.mock_calls)
+        _, args, _ = call.mock_calls[0]
+
+        assert next(args[0]) == request
+
+    # Establish that the response is the type that we expect.
+    message = await response.read()
+    assert isinstance(message, session.StreamingDetectIntentResponse)
+
+
+@pytest.mark.asyncio
+async def test_streaming_detect_intent_async_from_dict():
+    await test_streaming_detect_intent_async(request_type=dict)
+
+
+def test_credentials_transport_error():
+    # It is an error to provide credentials and a transport instance.
+    transport = transports.SessionsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionsClient(
+            credentials=credentials.AnonymousCredentials(), transport=transport,
+        )
+
+    # It is an error to provide a credentials file and a transport instance.
+    transport = transports.SessionsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionsClient(
+            client_options={"credentials_file": "credentials.json"},
+            transport=transport,
+        )
+
+    # It is an error to provide scopes and a transport instance.
+    transport = transports.SessionsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    with pytest.raises(ValueError):
+        client = SessionsClient(
+            client_options={"scopes": ["1", "2"]}, transport=transport,
+        )
+
+
+def test_transport_instance():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.SessionsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    client = SessionsClient(transport=transport)
+    assert client.transport is transport
+
+
+def test_transport_get_channel():
+    # A client may be instantiated with a custom transport instance.
+    transport = transports.SessionsGrpcTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+    transport = transports.SessionsGrpcAsyncIOTransport(
+        credentials=credentials.AnonymousCredentials(),
+    )
+    channel = transport.grpc_channel
+    assert channel
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.SessionsGrpcTransport, transports.SessionsGrpcAsyncIOTransport],
+)
+def test_transport_adc(transport_class):
+    # Test default credentials are used if not provided.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport_class()
+        adc.assert_called_once()
+
+
+def test_transport_grpc_default():
+    # A client should use the gRPC transport by default.
+    client = SessionsClient(credentials=credentials.AnonymousCredentials(),)
+    assert isinstance(client.transport, transports.SessionsGrpcTransport,)
+
+
+def test_sessions_base_transport_error():
+    # Passing both a credentials object and credentials_file should raise an error
+    with pytest.raises(exceptions.DuplicateCredentialArgs):
+        transport = transports.SessionsTransport(
+            credentials=credentials.AnonymousCredentials(),
+            credentials_file="credentials.json",
+        )
+
+
+def test_sessions_base_transport():
+    # Instantiate the base transport.
+    with mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.sessions.transports.SessionsTransport.__init__"
+    ) as Transport:
+        Transport.return_value = None
+        transport = transports.SessionsTransport(
+            credentials=credentials.AnonymousCredentials(),
+        )
+
+    # Every method on the transport should just blindly
+    # raise NotImplementedError.
+    methods = (
+        "detect_intent",
+        "streaming_detect_intent",
+    )
+    for method in methods:
+        with pytest.raises(NotImplementedError):
+            getattr(transport, method)(request=object())
+
+
+def test_sessions_base_transport_with_credentials_file():
+    # Instantiate the base transport with a credentials file
+    with mock.patch.object(
+        auth, "load_credentials_from_file"
+    ) as load_creds, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.sessions.transports.SessionsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        load_creds.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.SessionsTransport(
+            credentials_file="credentials.json", quota_project_id="octopus",
+        )
+        load_creds.assert_called_once_with(
+            "credentials.json",
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_sessions_base_transport_with_adc():
+    # Test the default credentials are used if credentials and credentials_file are None.
+    with mock.patch.object(auth, "default") as adc, mock.patch(
+        "google.cloud.dialogflow_v2beta1.services.sessions.transports.SessionsTransport._prep_wrapped_messages"
+    ) as Transport:
+        Transport.return_value = None
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transport = transports.SessionsTransport()
+        adc.assert_called_once()
+
+
+def test_sessions_auth_adc():
+    # If no credentials are provided, we should use ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        SessionsClient()
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id=None,
+        )
+
+
+def test_sessions_transport_auth_adc():
+    # If credentials and host are not provided, the transport class should use
+    # ADC credentials.
+    with mock.patch.object(auth, "default") as adc:
+        adc.return_value = (credentials.AnonymousCredentials(), None)
+        transports.SessionsGrpcTransport(
+            host="squid.clam.whelk", quota_project_id="octopus"
+        )
+        adc.assert_called_once_with(
+            scopes=(
+                "https://www.googleapis.com/auth/cloud-platform",
+                "https://www.googleapis.com/auth/dialogflow",
+            ),
+            quota_project_id="octopus",
+        )
+
+
+def test_sessions_host_no_port():
+    client = SessionsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:443"
+
+
+def test_sessions_host_with_port():
+    client = SessionsClient(
+        credentials=credentials.AnonymousCredentials(),
+        client_options=client_options.ClientOptions(
+            api_endpoint="dialogflow.googleapis.com:8000"
+        ),
+    )
+    assert client.transport._host == "dialogflow.googleapis.com:8000"
+
+
+def test_sessions_grpc_transport_channel():
+    channel = grpc.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.SessionsGrpcTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+def test_sessions_grpc_asyncio_transport_channel():
+    channel = aio.insecure_channel("http://localhost/")
+
+    # Check that channel is used if provided.
+    transport = transports.SessionsGrpcAsyncIOTransport(
+        host="squid.clam.whelk", channel=channel,
+    )
+    assert transport.grpc_channel == channel
+    assert transport._host == "squid.clam.whelk:443"
+    assert transport._ssl_channel_credentials == None
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.SessionsGrpcTransport, transports.SessionsGrpcAsyncIOTransport],
+)
+def test_sessions_transport_channel_mtls_with_client_cert_source(transport_class):
+    with mock.patch(
+        "grpc.ssl_channel_credentials", autospec=True
+    ) as grpc_ssl_channel_cred:
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_ssl_cred = mock.Mock()
+            grpc_ssl_channel_cred.return_value = mock_ssl_cred
+
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+
+            cred = credentials.AnonymousCredentials()
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.object(auth, "default") as adc:
+                    adc.return_value = (cred, None)
+                    transport = transport_class(
+                        host="squid.clam.whelk",
+                        api_mtls_endpoint="mtls.squid.clam.whelk",
+                        client_cert_source=client_cert_source_callback,
+                    )
+                    adc.assert_called_once()
+
+            grpc_ssl_channel_cred.assert_called_once_with(
+                certificate_chain=b"cert bytes", private_key=b"key bytes"
+            )
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+            assert transport._ssl_channel_credentials == mock_ssl_cred
+
+
+@pytest.mark.parametrize(
+    "transport_class",
+    [transports.SessionsGrpcTransport, transports.SessionsGrpcAsyncIOTransport],
+)
+def test_sessions_transport_channel_mtls_with_adc(transport_class):
+    mock_ssl_cred = mock.Mock()
+    with mock.patch.multiple(
+        "google.auth.transport.grpc.SslCredentials",
+        __init__=mock.Mock(return_value=None),
+        ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred),
+    ):
+        with mock.patch.object(
+            transport_class, "create_channel", autospec=True
+        ) as grpc_create_channel:
+            mock_grpc_channel = mock.Mock()
+            grpc_create_channel.return_value = mock_grpc_channel
+            mock_cred = mock.Mock()
+
+            with pytest.warns(DeprecationWarning):
+                transport = transport_class(
+                    host="squid.clam.whelk",
+                    credentials=mock_cred,
+                    api_mtls_endpoint="mtls.squid.clam.whelk",
+                    client_cert_source=None,
+                )
+
+            grpc_create_channel.assert_called_once_with(
+                "mtls.squid.clam.whelk:443",
+                credentials=mock_cred,
+                credentials_file=None,
+                scopes=(
+                    "https://www.googleapis.com/auth/cloud-platform",
+                    "https://www.googleapis.com/auth/dialogflow",
+                ),
+                ssl_credentials=mock_ssl_cred,
+                quota_project_id=None,
+            )
+            assert transport.grpc_channel == mock_grpc_channel
+
+
+def test_context_path():
+    project = "squid"
+    session = "clam"
+    context = "whelk"
+
+    expected = "projects/{project}/agent/sessions/{session}/contexts/{context}".format(
+        project=project, session=session, context=context,
+    )
+    actual = SessionsClient.context_path(project, session, context)
+    assert expected == actual
+
+
+def test_parse_context_path():
+    expected = {
+        "project": "octopus",
+        "session": "oyster",
+        "context": "nudibranch",
+    }
+    path = SessionsClient.context_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_context_path(path)
+    assert expected == actual
+
+
+def test_document_path():
+    project = "cuttlefish"
+    knowledge_base = "mussel"
+    document = "winkle"
+
+    expected = "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}".format(
+        project=project, knowledge_base=knowledge_base, document=document,
+    )
+    actual = SessionsClient.document_path(project, knowledge_base, document)
+    assert expected == actual
+
+
+def test_parse_document_path():
+    expected = {
+        "project": "nautilus",
+        "knowledge_base": "scallop",
+        "document": "abalone",
+    }
+    path = SessionsClient.document_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_document_path(path)
+    assert expected == actual
+
+
+def test_intent_path():
+    project = "squid"
+    intent = "clam"
+
+    expected = "projects/{project}/agent/intents/{intent}".format(
+        project=project, intent=intent,
+    )
+    actual = SessionsClient.intent_path(project, intent)
+    assert expected == actual
+
+
+def test_parse_intent_path():
+    expected = {
+        "project": "whelk",
+        "intent": "octopus",
+    }
+    path = SessionsClient.intent_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_intent_path(path)
+    assert expected == actual
+
+
+def test_session_path():
+    project = "oyster"
+    session = "nudibranch"
+
+    expected = "projects/{project}/agent/sessions/{session}".format(
+        project=project, session=session,
+    )
+    actual = SessionsClient.session_path(project, session)
+    assert expected == actual
+
+
+def test_parse_session_path():
+    expected = {
+        "project": "cuttlefish",
+        "session": "mussel",
+    }
+    path = SessionsClient.session_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_session_path(path)
+    assert expected == actual
+
+
+def test_session_entity_type_path():
+    project = "winkle"
+    session = "nautilus"
+    entity_type = "scallop"
+
+    expected = "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}".format(
+        project=project, session=session, entity_type=entity_type,
+    )
+    actual = SessionsClient.session_entity_type_path(project, session, entity_type)
+    assert expected == actual
+
+
+def test_parse_session_entity_type_path():
+    expected = {
+        "project": "abalone",
+        "session": "squid",
+        "entity_type": "clam",
+    }
+    path = SessionsClient.session_entity_type_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_session_entity_type_path(path)
+    assert expected == actual
+
+
+def test_common_billing_account_path():
+    billing_account = "whelk"
+
+    expected = "billingAccounts/{billing_account}".format(
+        billing_account=billing_account,
+    )
+    actual = SessionsClient.common_billing_account_path(billing_account)
+    assert expected == actual
+
+
+def test_parse_common_billing_account_path():
+    expected = {
+        "billing_account": "octopus",
+    }
+    path = SessionsClient.common_billing_account_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_common_billing_account_path(path)
+    assert expected == actual
+
+
+def test_common_folder_path():
+    folder = "oyster"
+
+    expected = "folders/{folder}".format(folder=folder,)
+    actual = SessionsClient.common_folder_path(folder)
+    assert expected == actual
+
+
+def test_parse_common_folder_path():
+    expected = {
+        "folder": "nudibranch",
+    }
+    path = SessionsClient.common_folder_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_common_folder_path(path)
+    assert expected == actual
+
+
+def test_common_organization_path():
+    organization = "cuttlefish"
+
+    expected = "organizations/{organization}".format(organization=organization,)
+    actual = SessionsClient.common_organization_path(organization)
+    assert expected == actual
+
+
+def test_parse_common_organization_path():
+    expected = {
+        "organization": "mussel",
+    }
+    path = SessionsClient.common_organization_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_common_organization_path(path)
+    assert expected == actual
+
+
+def test_common_project_path():
+    project = "winkle"
+
+    expected = "projects/{project}".format(project=project,)
+    actual = SessionsClient.common_project_path(project)
+    assert expected == actual
+
+
+def test_parse_common_project_path():
+    expected = {
+        "project": "nautilus",
+    }
+    path = SessionsClient.common_project_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_common_project_path(path)
+    assert expected == actual
+
+
+def test_common_location_path():
+    project = "scallop"
+    location = "abalone"
+
+    expected = "projects/{project}/locations/{location}".format(
+        project=project, location=location,
+    )
+    actual = SessionsClient.common_location_path(project, location)
+    assert expected == actual
+
+
+def test_parse_common_location_path():
+    expected = {
+        "project": "squid",
+        "location": "clam",
+    }
+    path = SessionsClient.common_location_path(**expected)
+
+    # Check that the path construction is reversible.
+    actual = SessionsClient.parse_common_location_path(path)
+    assert expected == actual
+
+
+def test_client_withDEFAULT_CLIENT_INFO():
+    client_info = gapic_v1.client_info.ClientInfo()
+
+    with mock.patch.object(
+        transports.SessionsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        client = SessionsClient(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
+
+    with mock.patch.object(
+        transports.SessionsTransport, "_prep_wrapped_messages"
+    ) as prep:
+        transport_class = SessionsClient.get_transport_class()
+        transport = transport_class(
+            credentials=credentials.AnonymousCredentials(), client_info=client_info,
+        )
+        prep.assert_called_once_with(client_info)
diff --git a/tests/unit/gapic/v2/test_agents_client_v2.py b/tests/unit/gapic/v2/test_agents_client_v2.py
deleted file mode 100644
index ae6b12404..000000000
--- a/tests/unit/gapic/v2/test_agents_client_v2.py
+++ /dev/null
@@ -1,490 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-from google.rpc import status_pb2
-
-import dialogflow_v2
-from dialogflow_v2.proto import agent_pb2
-from dialogflow_v2.proto import validation_result_pb2
-from google.longrunning import operations_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestAgentsClient(object):
-    def test_get_agent(self):
-        # Setup Expected Response
-        parent_2 = "parent21175163357"
-        display_name = "displayName1615086568"
-        default_language_code = "defaultLanguageCode856575222"
-        time_zone = "timeZone36848094"
-        description = "description-1724546052"
-        avatar_uri = "avatarUri-402824826"
-        enable_logging = False
-        classification_threshold = 1.11581064e8
-        expected_response = {
-            "parent": parent_2,
-            "display_name": display_name,
-            "default_language_code": default_language_code,
-            "time_zone": time_zone,
-            "description": description,
-            "avatar_uri": avatar_uri,
-            "enable_logging": enable_logging,
-            "classification_threshold": classification_threshold,
-        }
-        expected_response = agent_pb2.Agent(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.get_agent(parent)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.GetAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_agent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup request
-        parent = client.project_path("[PROJECT]")
-
-        with pytest.raises(CustomException):
-            client.get_agent(parent)
-
-    def test_set_agent(self):
-        # Setup Expected Response
-        parent = "parent-995424086"
-        display_name = "displayName1615086568"
-        default_language_code = "defaultLanguageCode856575222"
-        time_zone = "timeZone36848094"
-        description = "description-1724546052"
-        avatar_uri = "avatarUri-402824826"
-        enable_logging = False
-        classification_threshold = 1.11581064e8
-        expected_response = {
-            "parent": parent,
-            "display_name": display_name,
-            "default_language_code": default_language_code,
-            "time_zone": time_zone,
-            "description": description,
-            "avatar_uri": avatar_uri,
-            "enable_logging": enable_logging,
-            "classification_threshold": classification_threshold,
-        }
-        expected_response = agent_pb2.Agent(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        agent = {}
-
-        response = client.set_agent(agent)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.SetAgentRequest(agent=agent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_set_agent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup request
-        agent = {}
-
-        with pytest.raises(CustomException):
-            client.set_agent(agent)
-
-    def test_delete_agent(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        client.delete_agent(parent)
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.DeleteAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_agent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup request
-        parent = client.project_path("[PROJECT]")
-
-        with pytest.raises(CustomException):
-            client.delete_agent(parent)
-
-    def test_search_agents(self):
-        # Setup Expected Response
-        next_page_token = ""
-        agents_element = {}
-        agents = [agents_element]
-        expected_response = {"next_page_token": next_page_token, "agents": agents}
-        expected_response = agent_pb2.SearchAgentsResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        paged_list_response = client.search_agents(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.agents[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.SearchAgentsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_search_agents_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup request
-        parent = client.project_path("[PROJECT]")
-
-        paged_list_response = client.search_agents(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_train_agent(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_train_agent", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.train_agent(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.TrainAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_train_agent_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_train_agent_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.train_agent(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_export_agent(self):
-        # Setup Expected Response
-        agent_uri_2 = "agentUri21997190245"
-        expected_response = {"agent_uri": agent_uri_2}
-        expected_response = agent_pb2.ExportAgentResponse(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_export_agent", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-        agent_uri = "agentUri-1700713166"
-
-        response = client.export_agent(parent, agent_uri)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.ExportAgentRequest(
-            parent=parent, agent_uri=agent_uri
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_export_agent_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_export_agent_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-        agent_uri = "agentUri-1700713166"
-
-        response = client.export_agent(parent, agent_uri)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_import_agent(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_import_agent", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.import_agent(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.ImportAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_import_agent_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_import_agent_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.import_agent(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_restore_agent(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_restore_agent", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.restore_agent(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.RestoreAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_restore_agent_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_restore_agent_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.restore_agent(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_get_validation_result(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = validation_result_pb2.ValidationResult(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.get_validation_result(parent)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.GetValidationResultRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_validation_result_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.AgentsClient()
-
-        # Setup request
-        parent = client.project_path("[PROJECT]")
-
-        with pytest.raises(CustomException):
-            client.get_validation_result(parent)
diff --git a/tests/unit/gapic/v2/test_contexts_client_v2.py b/tests/unit/gapic/v2/test_contexts_client_v2.py
deleted file mode 100644
index 7003bc6c6..000000000
--- a/tests/unit/gapic/v2/test_contexts_client_v2.py
+++ /dev/null
@@ -1,288 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-import dialogflow_v2
-from dialogflow_v2.proto import context_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestContextsClient(object):
-    def test_list_contexts(self):
-        # Setup Expected Response
-        next_page_token = ""
-        contexts_element = {}
-        contexts = [contexts_element]
-        expected_response = {"next_page_token": next_page_token, "contexts": contexts}
-        expected_response = context_pb2.ListContextsResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_contexts(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.contexts[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.ListContextsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_contexts_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_contexts(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_get_context(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        lifespan_count = 1178775510
-        expected_response = {"name": name_2, "lifespan_count": lifespan_count}
-        expected_response = context_pb2.Context(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        response = client.get_context(name)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.GetContextRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_context_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.get_context(name)
-
-    def test_create_context(self):
-        # Setup Expected Response
-        name = "name3373707"
-        lifespan_count = 1178775510
-        expected_response = {"name": name, "lifespan_count": lifespan_count}
-        expected_response = context_pb2.Context(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        context = {}
-
-        response = client.create_context(parent, context)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.CreateContextRequest(
-            parent=parent, context=context
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_create_context_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup request
-        parent = "parent-995424086"
-        context = {}
-
-        with pytest.raises(CustomException):
-            client.create_context(parent, context)
-
-    def test_update_context(self):
-        # Setup Expected Response
-        name = "name3373707"
-        lifespan_count = 1178775510
-        expected_response = {"name": name, "lifespan_count": lifespan_count}
-        expected_response = context_pb2.Context(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup Request
-        context = {}
-
-        response = client.update_context(context)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.UpdateContextRequest(context=context)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_update_context_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup request
-        context = {}
-
-        with pytest.raises(CustomException):
-            client.update_context(context)
-
-    def test_delete_context(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        client.delete_context(name)
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.DeleteContextRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_context_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.delete_context(name)
-
-    def test_delete_all_contexts(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        client.delete_all_contexts(parent)
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.DeleteAllContextsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_all_contexts_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.ContextsClient()
-
-        # Setup request
-        parent = "parent-995424086"
-
-        with pytest.raises(CustomException):
-            client.delete_all_contexts(parent)
diff --git a/tests/unit/gapic/v2/test_entity_types_client_v2.py b/tests/unit/gapic/v2/test_entity_types_client_v2.py
deleted file mode 100644
index 248ab4569..000000000
--- a/tests/unit/gapic/v2/test_entity_types_client_v2.py
+++ /dev/null
@@ -1,548 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-from google.rpc import status_pb2
-
-import dialogflow_v2
-from dialogflow_v2.proto import entity_type_pb2
-from google.longrunning import operations_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestEntityTypesClient(object):
-    def test_list_entity_types(self):
-        # Setup Expected Response
-        next_page_token = ""
-        entity_types_element = {}
-        entity_types = [entity_types_element]
-        expected_response = {
-            "next_page_token": next_page_token,
-            "entity_types": entity_types,
-        }
-        expected_response = entity_type_pb2.ListEntityTypesResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]")
-
-        paged_list_response = client.list_entity_types(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.entity_types[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.ListEntityTypesRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_entity_types_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup request
-        parent = client.agent_path("[PROJECT]")
-
-        paged_list_response = client.list_entity_types(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_get_entity_type(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        display_name = "displayName1615086568"
-        enable_fuzzy_extraction = True
-        expected_response = {
-            "name": name_2,
-            "display_name": display_name,
-            "enable_fuzzy_extraction": enable_fuzzy_extraction,
-        }
-        expected_response = entity_type_pb2.EntityType(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        name = client.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
-
-        response = client.get_entity_type(name)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.GetEntityTypeRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup request
-        name = client.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
-
-        with pytest.raises(CustomException):
-            client.get_entity_type(name)
-
-    def test_create_entity_type(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        enable_fuzzy_extraction = True
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "enable_fuzzy_extraction": enable_fuzzy_extraction,
-        }
-        expected_response = entity_type_pb2.EntityType(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]")
-        entity_type = {}
-
-        response = client.create_entity_type(parent, entity_type)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.CreateEntityTypeRequest(
-            parent=parent, entity_type=entity_type
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_create_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup request
-        parent = client.agent_path("[PROJECT]")
-        entity_type = {}
-
-        with pytest.raises(CustomException):
-            client.create_entity_type(parent, entity_type)
-
-    def test_update_entity_type(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        enable_fuzzy_extraction = True
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "enable_fuzzy_extraction": enable_fuzzy_extraction,
-        }
-        expected_response = entity_type_pb2.EntityType(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        entity_type = {}
-
-        response = client.update_entity_type(entity_type)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.UpdateEntityTypeRequest(
-            entity_type=entity_type
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_update_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup request
-        entity_type = {}
-
-        with pytest.raises(CustomException):
-            client.update_entity_type(entity_type)
-
-    def test_delete_entity_type(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        name = client.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
-
-        client.delete_entity_type(name)
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.DeleteEntityTypeRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup request
-        name = client.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
-
-        with pytest.raises(CustomException):
-            client.delete_entity_type(name)
-
-    def test_batch_update_entity_types(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = entity_type_pb2.BatchUpdateEntityTypesResponse(
-            **expected_response
-        )
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_entity_types", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]")
-
-        response = client.batch_update_entity_types(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.BatchUpdateEntityTypesRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_update_entity_types_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_entity_types_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]")
-
-        response = client.batch_update_entity_types(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_batch_delete_entity_types(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_entity_types", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]")
-        entity_type_names = []
-
-        response = client.batch_delete_entity_types(parent, entity_type_names)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.BatchDeleteEntityTypesRequest(
-            parent=parent, entity_type_names=entity_type_names
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_delete_entity_types_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_entity_types_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]")
-        entity_type_names = []
-
-        response = client.batch_delete_entity_types(parent, entity_type_names)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_batch_create_entities(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_create_entities", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
-        entities = []
-
-        response = client.batch_create_entities(parent, entities)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.BatchCreateEntitiesRequest(
-            parent=parent, entities=entities
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_create_entities_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_create_entities_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
-        entities = []
-
-        response = client.batch_create_entities(parent, entities)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_batch_update_entities(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_entities", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
-        entities = []
-
-        response = client.batch_update_entities(parent, entities)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.BatchUpdateEntitiesRequest(
-            parent=parent, entities=entities
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_update_entities_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_entities_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
-        entities = []
-
-        response = client.batch_update_entities(parent, entities)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_batch_delete_entities(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_entities", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
-        entity_values = []
-
-        response = client.batch_delete_entities(parent, entity_values)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.BatchDeleteEntitiesRequest(
-            parent=parent, entity_values=entity_values
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_delete_entities_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_entities_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EntityTypesClient()
-
-        # Setup Request
-        parent = client.entity_type_path("[PROJECT]", "[ENTITY_TYPE]")
-        entity_values = []
-
-        response = client.batch_delete_entities(parent, entity_values)
-        exception = response.exception()
-        assert exception.errors[0] == error
diff --git a/tests/unit/gapic/v2/test_environments_client_v2.py b/tests/unit/gapic/v2/test_environments_client_v2.py
deleted file mode 100644
index f1b514421..000000000
--- a/tests/unit/gapic/v2/test_environments_client_v2.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-import dialogflow_v2
-from dialogflow_v2.proto import environment_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestEnvironmentsClient(object):
-    def test_list_environments(self):
-        # Setup Expected Response
-        next_page_token = ""
-        environments_element = {}
-        environments = [environments_element]
-        expected_response = {
-            "next_page_token": next_page_token,
-            "environments": environments,
-        }
-        expected_response = environment_pb2.ListEnvironmentsResponse(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EnvironmentsClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]")
-
-        paged_list_response = client.list_environments(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.environments[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = environment_pb2.ListEnvironmentsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_environments_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.EnvironmentsClient()
-
-        # Setup request
-        parent = client.agent_path("[PROJECT]")
-
-        paged_list_response = client.list_environments(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
diff --git a/tests/unit/gapic/v2/test_intents_client_v2.py b/tests/unit/gapic/v2/test_intents_client_v2.py
deleted file mode 100644
index 75a635ed7..000000000
--- a/tests/unit/gapic/v2/test_intents_client_v2.py
+++ /dev/null
@@ -1,413 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-from google.rpc import status_pb2
-
-import dialogflow_v2
-from dialogflow_v2.proto import intent_pb2
-from google.longrunning import operations_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestIntentsClient(object):
-    def test_list_intents(self):
-        # Setup Expected Response
-        next_page_token = ""
-        intents_element = {}
-        intents = [intents_element]
-        expected_response = {"next_page_token": next_page_token, "intents": intents}
-        expected_response = intent_pb2.ListIntentsResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]", "[AGENT]")
-
-        paged_list_response = client.list_intents(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.intents[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.ListIntentsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_intents_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup request
-        parent = client.agent_path("[PROJECT]", "[AGENT]")
-
-        paged_list_response = client.list_intents(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_get_intent(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        display_name = "displayName1615086568"
-        priority = 1165461084
-        is_fallback = False
-        ml_disabled = True
-        action = "action-1422950858"
-        reset_contexts = True
-        root_followup_intent_name = "rootFollowupIntentName402253784"
-        parent_followup_intent_name = "parentFollowupIntentName-1131901680"
-        expected_response = {
-            "name": name_2,
-            "display_name": display_name,
-            "priority": priority,
-            "is_fallback": is_fallback,
-            "ml_disabled": ml_disabled,
-            "action": action,
-            "reset_contexts": reset_contexts,
-            "root_followup_intent_name": root_followup_intent_name,
-            "parent_followup_intent_name": parent_followup_intent_name,
-        }
-        expected_response = intent_pb2.Intent(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup Request
-        name = client.intent_path("[PROJECT]", "[INTENT]")
-
-        response = client.get_intent(name)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.GetIntentRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup request
-        name = client.intent_path("[PROJECT]", "[INTENT]")
-
-        with pytest.raises(CustomException):
-            client.get_intent(name)
-
-    def test_create_intent(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        priority = 1165461084
-        is_fallback = False
-        ml_disabled = True
-        action = "action-1422950858"
-        reset_contexts = True
-        root_followup_intent_name = "rootFollowupIntentName402253784"
-        parent_followup_intent_name = "parentFollowupIntentName-1131901680"
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "priority": priority,
-            "is_fallback": is_fallback,
-            "ml_disabled": ml_disabled,
-            "action": action,
-            "reset_contexts": reset_contexts,
-            "root_followup_intent_name": root_followup_intent_name,
-            "parent_followup_intent_name": parent_followup_intent_name,
-        }
-        expected_response = intent_pb2.Intent(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]", "[AGENT]")
-        intent = {}
-
-        response = client.create_intent(parent, intent)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.CreateIntentRequest(parent=parent, intent=intent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_create_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup request
-        parent = client.agent_path("[PROJECT]", "[AGENT]")
-        intent = {}
-
-        with pytest.raises(CustomException):
-            client.create_intent(parent, intent)
-
-    def test_update_intent(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        priority = 1165461084
-        is_fallback = False
-        ml_disabled = True
-        action = "action-1422950858"
-        reset_contexts = True
-        root_followup_intent_name = "rootFollowupIntentName402253784"
-        parent_followup_intent_name = "parentFollowupIntentName-1131901680"
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "priority": priority,
-            "is_fallback": is_fallback,
-            "ml_disabled": ml_disabled,
-            "action": action,
-            "reset_contexts": reset_contexts,
-            "root_followup_intent_name": root_followup_intent_name,
-            "parent_followup_intent_name": parent_followup_intent_name,
-        }
-        expected_response = intent_pb2.Intent(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup Request
-        intent = {}
-
-        response = client.update_intent(intent)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.UpdateIntentRequest(intent=intent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_update_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup request
-        intent = {}
-
-        with pytest.raises(CustomException):
-            client.update_intent(intent)
-
-    def test_delete_intent(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup Request
-        name = client.intent_path("[PROJECT]", "[INTENT]")
-
-        client.delete_intent(name)
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.DeleteIntentRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup request
-        name = client.intent_path("[PROJECT]", "[INTENT]")
-
-        with pytest.raises(CustomException):
-            client.delete_intent(name)
-
-    def test_batch_update_intents(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = intent_pb2.BatchUpdateIntentsResponse(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_intents", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]", "[AGENT]")
-
-        response = client.batch_update_intents(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.BatchUpdateIntentsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_update_intents_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_intents_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]", "[AGENT]")
-
-        response = client.batch_update_intents(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_batch_delete_intents(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_intents", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]", "[AGENT]")
-        intents = []
-
-        response = client.batch_delete_intents(parent, intents)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.BatchDeleteIntentsRequest(
-            parent=parent, intents=intents
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_delete_intents_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_intents_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.IntentsClient()
-
-        # Setup Request
-        parent = client.agent_path("[PROJECT]", "[AGENT]")
-        intents = []
-
-        response = client.batch_delete_intents(parent, intents)
-        exception = response.exception()
-        assert exception.errors[0] == error
diff --git a/tests/unit/gapic/v2/test_session_entity_types_client_v2.py b/tests/unit/gapic/v2/test_session_entity_types_client_v2.py
deleted file mode 100644
index 1c2229f0e..000000000
--- a/tests/unit/gapic/v2/test_session_entity_types_client_v2.py
+++ /dev/null
@@ -1,273 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-import dialogflow_v2
-from dialogflow_v2.proto import session_entity_type_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestSessionEntityTypesClient(object):
-    def test_list_session_entity_types(self):
-        # Setup Expected Response
-        next_page_token = ""
-        session_entity_types_element = {}
-        session_entity_types = [session_entity_types_element]
-        expected_response = {
-            "next_page_token": next_page_token,
-            "session_entity_types": session_entity_types,
-        }
-        expected_response = session_entity_type_pb2.ListSessionEntityTypesResponse(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionEntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_session_entity_types(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.session_entity_types[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = session_entity_type_pb2.ListSessionEntityTypesRequest(
-            parent=parent
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_session_entity_types_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionEntityTypesClient()
-
-        # Setup request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_session_entity_types(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_get_session_entity_type(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        expected_response = {"name": name_2}
-        expected_response = session_entity_type_pb2.SessionEntityType(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionEntityTypesClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        response = client.get_session_entity_type(name)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = session_entity_type_pb2.GetSessionEntityTypeRequest(
-            name=name
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_session_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionEntityTypesClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.get_session_entity_type(name)
-
-    def test_create_session_entity_type(self):
-        # Setup Expected Response
-        name = "name3373707"
-        expected_response = {"name": name}
-        expected_response = session_entity_type_pb2.SessionEntityType(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionEntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        session_entity_type = {}
-
-        response = client.create_session_entity_type(parent, session_entity_type)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = session_entity_type_pb2.CreateSessionEntityTypeRequest(
-            parent=parent, session_entity_type=session_entity_type
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_create_session_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionEntityTypesClient()
-
-        # Setup request
-        parent = "parent-995424086"
-        session_entity_type = {}
-
-        with pytest.raises(CustomException):
-            client.create_session_entity_type(parent, session_entity_type)
-
-    def test_update_session_entity_type(self):
-        # Setup Expected Response
-        name = "name3373707"
-        expected_response = {"name": name}
-        expected_response = session_entity_type_pb2.SessionEntityType(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionEntityTypesClient()
-
-        # Setup Request
-        session_entity_type = {}
-
-        response = client.update_session_entity_type(session_entity_type)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = session_entity_type_pb2.UpdateSessionEntityTypeRequest(
-            session_entity_type=session_entity_type
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_update_session_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionEntityTypesClient()
-
-        # Setup request
-        session_entity_type = {}
-
-        with pytest.raises(CustomException):
-            client.update_session_entity_type(session_entity_type)
-
-    def test_delete_session_entity_type(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionEntityTypesClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        client.delete_session_entity_type(name)
-
-        assert len(channel.requests) == 1
-        expected_request = session_entity_type_pb2.DeleteSessionEntityTypeRequest(
-            name=name
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_session_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionEntityTypesClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.delete_session_entity_type(name)
diff --git a/tests/unit/gapic/v2/test_sessions_client_v2.py b/tests/unit/gapic/v2/test_sessions_client_v2.py
deleted file mode 100644
index 1fcee8665..000000000
--- a/tests/unit/gapic/v2/test_sessions_client_v2.py
+++ /dev/null
@@ -1,162 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-import dialogflow_v2
-from dialogflow_v2.proto import session_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-    def stream_stream(
-        self, method, request_serializer=None, response_deserializer=None
-    ):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestSessionsClient(object):
-    def test_detect_intent(self):
-        # Setup Expected Response
-        response_id = "responseId1847552473"
-        output_audio = b"24"
-        expected_response = {"response_id": response_id, "output_audio": output_audio}
-        expected_response = session_pb2.DetectIntentResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionsClient()
-
-        # Setup Request
-        session = "session1984987798"
-        query_input = {}
-
-        response = client.detect_intent(session, query_input)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = session_pb2.DetectIntentRequest(
-            session=session, query_input=query_input
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_detect_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionsClient()
-
-        # Setup request
-        session = "session1984987798"
-        query_input = {}
-
-        with pytest.raises(CustomException):
-            client.detect_intent(session, query_input)
-
-    def test_streaming_detect_intent(self):
-        # Setup Expected Response
-        response_id = "responseId1847552473"
-        output_audio = b"24"
-        expected_response = {"response_id": response_id, "output_audio": output_audio}
-        expected_response = session_pb2.StreamingDetectIntentResponse(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[iter([expected_response])])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionsClient()
-
-        # Setup Request
-        session = "session1984987798"
-        query_input = {}
-        request = {"session": session, "query_input": query_input}
-        request = session_pb2.StreamingDetectIntentRequest(**request)
-        requests = [request]
-
-        response = client.streaming_detect_intent(requests)
-        resources = list(response)
-        assert len(resources) == 1
-        assert expected_response == resources[0]
-
-        assert len(channel.requests) == 1
-        actual_requests = channel.requests[0][1]
-        assert len(actual_requests) == 1
-        actual_request = list(actual_requests)[0]
-        assert request == actual_request
-
-    def test_streaming_detect_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2.SessionsClient()
-
-        # Setup request
-        session = "session1984987798"
-        query_input = {}
-        request = {"session": session, "query_input": query_input}
-
-        request = session_pb2.StreamingDetectIntentRequest(**request)
-        requests = [request]
-
-        with pytest.raises(CustomException):
-            client.streaming_detect_intent(requests)
diff --git a/tests/unit/gapic/v2beta1/test_agents_client_v2beta1.py b/tests/unit/gapic/v2beta1/test_agents_client_v2beta1.py
deleted file mode 100644
index 2e953da0c..000000000
--- a/tests/unit/gapic/v2beta1/test_agents_client_v2beta1.py
+++ /dev/null
@@ -1,486 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-from google.rpc import status_pb2
-
-import dialogflow_v2beta1
-from dialogflow_v2beta1.proto import agent_pb2
-from dialogflow_v2beta1.proto import validation_result_pb2
-from google.longrunning import operations_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestAgentsClient(object):
-    def test_get_agent(self):
-        # Setup Expected Response
-        parent_2 = "parent21175163357"
-        display_name = "displayName1615086568"
-        default_language_code = "defaultLanguageCode856575222"
-        time_zone = "timeZone36848094"
-        description = "description-1724546052"
-        avatar_uri = "avatarUri-402824826"
-        enable_logging = False
-        classification_threshold = 1.11581064e8
-        expected_response = {
-            "parent": parent_2,
-            "display_name": display_name,
-            "default_language_code": default_language_code,
-            "time_zone": time_zone,
-            "description": description,
-            "avatar_uri": avatar_uri,
-            "enable_logging": enable_logging,
-            "classification_threshold": classification_threshold,
-        }
-        expected_response = agent_pb2.Agent(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.get_agent(parent)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.GetAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_agent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup request
-        parent = client.project_path("[PROJECT]")
-
-        with pytest.raises(CustomException):
-            client.get_agent(parent)
-
-    def test_set_agent(self):
-        # Setup Expected Response
-        parent = "parent-995424086"
-        display_name = "displayName1615086568"
-        default_language_code = "defaultLanguageCode856575222"
-        time_zone = "timeZone36848094"
-        description = "description-1724546052"
-        avatar_uri = "avatarUri-402824826"
-        enable_logging = False
-        classification_threshold = 1.11581064e8
-        expected_response = {
-            "parent": parent,
-            "display_name": display_name,
-            "default_language_code": default_language_code,
-            "time_zone": time_zone,
-            "description": description,
-            "avatar_uri": avatar_uri,
-            "enable_logging": enable_logging,
-            "classification_threshold": classification_threshold,
-        }
-        expected_response = agent_pb2.Agent(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        agent = {}
-
-        response = client.set_agent(agent)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.SetAgentRequest(agent=agent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_set_agent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup request
-        agent = {}
-
-        with pytest.raises(CustomException):
-            client.set_agent(agent)
-
-    def test_delete_agent(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        client.delete_agent(parent)
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.DeleteAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_agent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup request
-        parent = client.project_path("[PROJECT]")
-
-        with pytest.raises(CustomException):
-            client.delete_agent(parent)
-
-    def test_search_agents(self):
-        # Setup Expected Response
-        next_page_token = ""
-        agents_element = {}
-        agents = [agents_element]
-        expected_response = {"next_page_token": next_page_token, "agents": agents}
-        expected_response = agent_pb2.SearchAgentsResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        paged_list_response = client.search_agents(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.agents[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.SearchAgentsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_search_agents_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup request
-        parent = client.project_path("[PROJECT]")
-
-        paged_list_response = client.search_agents(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_train_agent(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_train_agent", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.train_agent(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.TrainAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_train_agent_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_train_agent_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.train_agent(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_export_agent(self):
-        # Setup Expected Response
-        agent_uri = "agentUri-1700713166"
-        expected_response = {"agent_uri": agent_uri}
-        expected_response = agent_pb2.ExportAgentResponse(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_export_agent", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.export_agent(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.ExportAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_export_agent_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_export_agent_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.export_agent(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_import_agent(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_import_agent", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.import_agent(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.ImportAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_import_agent_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_import_agent_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.import_agent(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_restore_agent(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_restore_agent", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.restore_agent(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.RestoreAgentRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_restore_agent_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_restore_agent_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.restore_agent(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_get_validation_result(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = validation_result_pb2.ValidationResult(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        response = client.get_validation_result(parent)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = agent_pb2.GetValidationResultRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_validation_result_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.AgentsClient()
-
-        # Setup request
-        parent = client.project_path("[PROJECT]")
-
-        with pytest.raises(CustomException):
-            client.get_validation_result(parent)
diff --git a/tests/unit/gapic/v2beta1/test_contexts_client_v2beta1.py b/tests/unit/gapic/v2beta1/test_contexts_client_v2beta1.py
deleted file mode 100644
index c6b946d2e..000000000
--- a/tests/unit/gapic/v2beta1/test_contexts_client_v2beta1.py
+++ /dev/null
@@ -1,288 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-import dialogflow_v2beta1
-from dialogflow_v2beta1.proto import context_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestContextsClient(object):
-    def test_list_contexts(self):
-        # Setup Expected Response
-        next_page_token = ""
-        contexts_element = {}
-        contexts = [contexts_element]
-        expected_response = {"next_page_token": next_page_token, "contexts": contexts}
-        expected_response = context_pb2.ListContextsResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_contexts(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.contexts[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.ListContextsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_contexts_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_contexts(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_get_context(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        lifespan_count = 1178775510
-        expected_response = {"name": name_2, "lifespan_count": lifespan_count}
-        expected_response = context_pb2.Context(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        response = client.get_context(name)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.GetContextRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_context_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.get_context(name)
-
-    def test_create_context(self):
-        # Setup Expected Response
-        name = "name3373707"
-        lifespan_count = 1178775510
-        expected_response = {"name": name, "lifespan_count": lifespan_count}
-        expected_response = context_pb2.Context(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        context = {}
-
-        response = client.create_context(parent, context)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.CreateContextRequest(
-            parent=parent, context=context
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_create_context_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup request
-        parent = "parent-995424086"
-        context = {}
-
-        with pytest.raises(CustomException):
-            client.create_context(parent, context)
-
-    def test_update_context(self):
-        # Setup Expected Response
-        name = "name3373707"
-        lifespan_count = 1178775510
-        expected_response = {"name": name, "lifespan_count": lifespan_count}
-        expected_response = context_pb2.Context(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup Request
-        context = {}
-
-        response = client.update_context(context)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.UpdateContextRequest(context=context)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_update_context_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup request
-        context = {}
-
-        with pytest.raises(CustomException):
-            client.update_context(context)
-
-    def test_delete_context(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        client.delete_context(name)
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.DeleteContextRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_context_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.delete_context(name)
-
-    def test_delete_all_contexts(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        client.delete_all_contexts(parent)
-
-        assert len(channel.requests) == 1
-        expected_request = context_pb2.DeleteAllContextsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_all_contexts_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.ContextsClient()
-
-        # Setup request
-        parent = "parent-995424086"
-
-        with pytest.raises(CustomException):
-            client.delete_all_contexts(parent)
diff --git a/tests/unit/gapic/v2beta1/test_documents_client_v2beta1.py b/tests/unit/gapic/v2beta1/test_documents_client_v2beta1.py
deleted file mode 100644
index 3481b3e73..000000000
--- a/tests/unit/gapic/v2beta1/test_documents_client_v2beta1.py
+++ /dev/null
@@ -1,393 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-from google.rpc import status_pb2
-
-import dialogflow_v2beta1
-from dialogflow_v2beta1.proto import document_pb2
-from google.longrunning import operations_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestDocumentsClient(object):
-    def test_list_documents(self):
-        # Setup Expected Response
-        next_page_token = ""
-        documents_element = {}
-        documents = [documents_element]
-        expected_response = {"next_page_token": next_page_token, "documents": documents}
-        expected_response = document_pb2.ListDocumentsResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup Request
-        parent = client.knowledge_base_path("[PROJECT]", "[KNOWLEDGE_BASE]")
-
-        paged_list_response = client.list_documents(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.documents[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = document_pb2.ListDocumentsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_documents_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup request
-        parent = client.knowledge_base_path("[PROJECT]", "[KNOWLEDGE_BASE]")
-
-        paged_list_response = client.list_documents(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_get_document(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        display_name = "displayName1615086568"
-        mime_type = "mimeType-196041627"
-        content_uri = "contentUri-388807514"
-        enable_auto_reload = False
-        expected_response = {
-            "name": name_2,
-            "display_name": display_name,
-            "mime_type": mime_type,
-            "content_uri": content_uri,
-            "enable_auto_reload": enable_auto_reload,
-        }
-        expected_response = document_pb2.Document(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup Request
-        name = client.document_path("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]")
-
-        response = client.get_document(name)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = document_pb2.GetDocumentRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_document_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup request
-        name = client.document_path("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]")
-
-        with pytest.raises(CustomException):
-            client.get_document(name)
-
-    def test_create_document(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        mime_type = "mimeType-196041627"
-        content_uri = "contentUri-388807514"
-        enable_auto_reload = False
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "mime_type": mime_type,
-            "content_uri": content_uri,
-            "enable_auto_reload": enable_auto_reload,
-        }
-        expected_response = document_pb2.Document(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_create_document", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup Request
-        parent = client.knowledge_base_path("[PROJECT]", "[KNOWLEDGE_BASE]")
-        document = {}
-
-        response = client.create_document(parent, document)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = document_pb2.CreateDocumentRequest(
-            parent=parent, document=document
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_create_document_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_create_document_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup Request
-        parent = client.knowledge_base_path("[PROJECT]", "[KNOWLEDGE_BASE]")
-        document = {}
-
-        response = client.create_document(parent, document)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_delete_document(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_delete_document", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup Request
-        name = client.document_path("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]")
-
-        response = client.delete_document(name)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = document_pb2.DeleteDocumentRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_document_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_delete_document_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup Request
-        name = client.document_path("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]")
-
-        response = client.delete_document(name)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_update_document(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        mime_type = "mimeType-196041627"
-        content_uri = "contentUri-388807514"
-        enable_auto_reload = False
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "mime_type": mime_type,
-            "content_uri": content_uri,
-            "enable_auto_reload": enable_auto_reload,
-        }
-        expected_response = document_pb2.Document(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_update_document", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup Request
-        document = {}
-
-        response = client.update_document(document)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = document_pb2.UpdateDocumentRequest(document=document)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_update_document_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_update_document_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup Request
-        document = {}
-
-        response = client.update_document(document)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_reload_document(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        display_name = "displayName1615086568"
-        mime_type = "mimeType-196041627"
-        content_uri = "contentUri-388807514"
-        enable_auto_reload = False
-        expected_response = {
-            "name": name_2,
-            "display_name": display_name,
-            "mime_type": mime_type,
-            "content_uri": content_uri,
-            "enable_auto_reload": enable_auto_reload,
-        }
-        expected_response = document_pb2.Document(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_reload_document", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup Request
-        name = client.document_path("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]")
-
-        response = client.reload_document(name)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = document_pb2.ReloadDocumentRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_reload_document_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_reload_document_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.DocumentsClient()
-
-        # Setup Request
-        name = client.document_path("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]")
-
-        response = client.reload_document(name)
-        exception = response.exception()
-        assert exception.errors[0] == error
diff --git a/tests/unit/gapic/v2beta1/test_entity_types_client_v2beta1.py b/tests/unit/gapic/v2beta1/test_entity_types_client_v2beta1.py
deleted file mode 100644
index e2b8f3c49..000000000
--- a/tests/unit/gapic/v2beta1/test_entity_types_client_v2beta1.py
+++ /dev/null
@@ -1,548 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-from google.rpc import status_pb2
-
-import dialogflow_v2beta1
-from dialogflow_v2beta1.proto import entity_type_pb2
-from google.longrunning import operations_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestEntityTypesClient(object):
-    def test_list_entity_types(self):
-        # Setup Expected Response
-        next_page_token = ""
-        entity_types_element = {}
-        entity_types = [entity_types_element]
-        expected_response = {
-            "next_page_token": next_page_token,
-            "entity_types": entity_types,
-        }
-        expected_response = entity_type_pb2.ListEntityTypesResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_entity_types(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.entity_types[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.ListEntityTypesRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_entity_types_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_entity_types(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_get_entity_type(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        display_name = "displayName1615086568"
-        enable_fuzzy_extraction = True
-        expected_response = {
-            "name": name_2,
-            "display_name": display_name,
-            "enable_fuzzy_extraction": enable_fuzzy_extraction,
-        }
-        expected_response = entity_type_pb2.EntityType(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        response = client.get_entity_type(name)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.GetEntityTypeRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.get_entity_type(name)
-
-    def test_create_entity_type(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        enable_fuzzy_extraction = True
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "enable_fuzzy_extraction": enable_fuzzy_extraction,
-        }
-        expected_response = entity_type_pb2.EntityType(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        entity_type = {}
-
-        response = client.create_entity_type(parent, entity_type)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.CreateEntityTypeRequest(
-            parent=parent, entity_type=entity_type
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_create_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup request
-        parent = "parent-995424086"
-        entity_type = {}
-
-        with pytest.raises(CustomException):
-            client.create_entity_type(parent, entity_type)
-
-    def test_update_entity_type(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        enable_fuzzy_extraction = True
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "enable_fuzzy_extraction": enable_fuzzy_extraction,
-        }
-        expected_response = entity_type_pb2.EntityType(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        entity_type = {}
-
-        response = client.update_entity_type(entity_type)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.UpdateEntityTypeRequest(
-            entity_type=entity_type
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_update_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup request
-        entity_type = {}
-
-        with pytest.raises(CustomException):
-            client.update_entity_type(entity_type)
-
-    def test_delete_entity_type(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        client.delete_entity_type(name)
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.DeleteEntityTypeRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.delete_entity_type(name)
-
-    def test_batch_update_entity_types(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = entity_type_pb2.BatchUpdateEntityTypesResponse(
-            **expected_response
-        )
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_entity_types", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        response = client.batch_update_entity_types(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.BatchUpdateEntityTypesRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_update_entity_types_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_entity_types_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        response = client.batch_update_entity_types(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_batch_delete_entity_types(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_entity_types", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        entity_type_names = []
-
-        response = client.batch_delete_entity_types(parent, entity_type_names)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.BatchDeleteEntityTypesRequest(
-            parent=parent, entity_type_names=entity_type_names
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_delete_entity_types_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_entity_types_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        entity_type_names = []
-
-        response = client.batch_delete_entity_types(parent, entity_type_names)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_batch_create_entities(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_create_entities", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        entities = []
-
-        response = client.batch_create_entities(parent, entities)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.BatchCreateEntitiesRequest(
-            parent=parent, entities=entities
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_create_entities_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_create_entities_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        entities = []
-
-        response = client.batch_create_entities(parent, entities)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_batch_update_entities(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_entities", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        entities = []
-
-        response = client.batch_update_entities(parent, entities)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.BatchUpdateEntitiesRequest(
-            parent=parent, entities=entities
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_update_entities_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_entities_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        entities = []
-
-        response = client.batch_update_entities(parent, entities)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_batch_delete_entities(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_entities", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        entity_values = []
-
-        response = client.batch_delete_entities(parent, entity_values)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = entity_type_pb2.BatchDeleteEntitiesRequest(
-            parent=parent, entity_values=entity_values
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_delete_entities_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_entities_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        entity_values = []
-
-        response = client.batch_delete_entities(parent, entity_values)
-        exception = response.exception()
-        assert exception.errors[0] == error
diff --git a/tests/unit/gapic/v2beta1/test_environments_client_v2beta1.py b/tests/unit/gapic/v2beta1/test_environments_client_v2beta1.py
deleted file mode 100644
index a464b7071..000000000
--- a/tests/unit/gapic/v2beta1/test_environments_client_v2beta1.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-import dialogflow_v2beta1
-from dialogflow_v2beta1.proto import environment_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestEnvironmentsClient(object):
-    def test_list_environments(self):
-        # Setup Expected Response
-        next_page_token = ""
-        environments_element = {}
-        environments = [environments_element]
-        expected_response = {
-            "next_page_token": next_page_token,
-            "environments": environments,
-        }
-        expected_response = environment_pb2.ListEnvironmentsResponse(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EnvironmentsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_environments(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.environments[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = environment_pb2.ListEnvironmentsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_environments_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.EnvironmentsClient()
-
-        # Setup request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_environments(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
diff --git a/tests/unit/gapic/v2beta1/test_intents_client_v2beta1.py b/tests/unit/gapic/v2beta1/test_intents_client_v2beta1.py
deleted file mode 100644
index 772573fbf..000000000
--- a/tests/unit/gapic/v2beta1/test_intents_client_v2beta1.py
+++ /dev/null
@@ -1,425 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-from google.rpc import status_pb2
-
-import dialogflow_v2beta1
-from dialogflow_v2beta1.proto import intent_pb2
-from google.longrunning import operations_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestIntentsClient(object):
-    def test_list_intents(self):
-        # Setup Expected Response
-        next_page_token = ""
-        intents_element = {}
-        intents = [intents_element]
-        expected_response = {"next_page_token": next_page_token, "intents": intents}
-        expected_response = intent_pb2.ListIntentsResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_intents(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.intents[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.ListIntentsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_intents_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_intents(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_get_intent(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        display_name = "displayName1615086568"
-        priority = 1165461084
-        is_fallback = False
-        ml_enabled = False
-        ml_disabled = True
-        end_interaction = True
-        action = "action-1422950858"
-        reset_contexts = True
-        root_followup_intent_name = "rootFollowupIntentName402253784"
-        parent_followup_intent_name = "parentFollowupIntentName-1131901680"
-        expected_response = {
-            "name": name_2,
-            "display_name": display_name,
-            "priority": priority,
-            "is_fallback": is_fallback,
-            "ml_enabled": ml_enabled,
-            "ml_disabled": ml_disabled,
-            "end_interaction": end_interaction,
-            "action": action,
-            "reset_contexts": reset_contexts,
-            "root_followup_intent_name": root_followup_intent_name,
-            "parent_followup_intent_name": parent_followup_intent_name,
-        }
-        expected_response = intent_pb2.Intent(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        response = client.get_intent(name)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.GetIntentRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.get_intent(name)
-
-    def test_create_intent(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        priority = 1165461084
-        is_fallback = False
-        ml_enabled = False
-        ml_disabled = True
-        end_interaction = True
-        action = "action-1422950858"
-        reset_contexts = True
-        root_followup_intent_name = "rootFollowupIntentName402253784"
-        parent_followup_intent_name = "parentFollowupIntentName-1131901680"
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "priority": priority,
-            "is_fallback": is_fallback,
-            "ml_enabled": ml_enabled,
-            "ml_disabled": ml_disabled,
-            "end_interaction": end_interaction,
-            "action": action,
-            "reset_contexts": reset_contexts,
-            "root_followup_intent_name": root_followup_intent_name,
-            "parent_followup_intent_name": parent_followup_intent_name,
-        }
-        expected_response = intent_pb2.Intent(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        intent = {}
-
-        response = client.create_intent(parent, intent)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.CreateIntentRequest(parent=parent, intent=intent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_create_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup request
-        parent = "parent-995424086"
-        intent = {}
-
-        with pytest.raises(CustomException):
-            client.create_intent(parent, intent)
-
-    def test_update_intent(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        priority = 1165461084
-        is_fallback = False
-        ml_enabled = False
-        ml_disabled = True
-        end_interaction = True
-        action = "action-1422950858"
-        reset_contexts = True
-        root_followup_intent_name = "rootFollowupIntentName402253784"
-        parent_followup_intent_name = "parentFollowupIntentName-1131901680"
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "priority": priority,
-            "is_fallback": is_fallback,
-            "ml_enabled": ml_enabled,
-            "ml_disabled": ml_disabled,
-            "end_interaction": end_interaction,
-            "action": action,
-            "reset_contexts": reset_contexts,
-            "root_followup_intent_name": root_followup_intent_name,
-            "parent_followup_intent_name": parent_followup_intent_name,
-        }
-        expected_response = intent_pb2.Intent(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup Request
-        intent = {}
-
-        response = client.update_intent(intent)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.UpdateIntentRequest(intent=intent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_update_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup request
-        intent = {}
-
-        with pytest.raises(CustomException):
-            client.update_intent(intent)
-
-    def test_delete_intent(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        client.delete_intent(name)
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.DeleteIntentRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.delete_intent(name)
-
-    def test_batch_update_intents(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = intent_pb2.BatchUpdateIntentsResponse(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_intents", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        response = client.batch_update_intents(parent)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.BatchUpdateIntentsRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_update_intents_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_update_intents_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        response = client.batch_update_intents(parent)
-        exception = response.exception()
-        assert exception.errors[0] == error
-
-    def test_batch_delete_intents(self):
-        # Setup Expected Response
-        expected_response = {}
-        expected_response = empty_pb2.Empty(**expected_response)
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_intents", done=True
-        )
-        operation.response.Pack(expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        intents = []
-
-        response = client.batch_delete_intents(parent, intents)
-        result = response.result()
-        assert expected_response == result
-
-        assert len(channel.requests) == 1
-        expected_request = intent_pb2.BatchDeleteIntentsRequest(
-            parent=parent, intents=intents
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_batch_delete_intents_exception(self):
-        # Setup Response
-        error = status_pb2.Status()
-        operation = operations_pb2.Operation(
-            name="operations/test_batch_delete_intents_exception", done=True
-        )
-        operation.error.CopyFrom(error)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[operation])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.IntentsClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        intents = []
-
-        response = client.batch_delete_intents(parent, intents)
-        exception = response.exception()
-        assert exception.errors[0] == error
diff --git a/tests/unit/gapic/v2beta1/test_knowledge_bases_client_v2beta1.py b/tests/unit/gapic/v2beta1/test_knowledge_bases_client_v2beta1.py
deleted file mode 100644
index 8a4fd334e..000000000
--- a/tests/unit/gapic/v2beta1/test_knowledge_bases_client_v2beta1.py
+++ /dev/null
@@ -1,279 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-import dialogflow_v2beta1
-from dialogflow_v2beta1.proto import knowledge_base_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestKnowledgeBasesClient(object):
-    def test_list_knowledge_bases(self):
-        # Setup Expected Response
-        next_page_token = ""
-        knowledge_bases_element = {}
-        knowledge_bases = [knowledge_bases_element]
-        expected_response = {
-            "next_page_token": next_page_token,
-            "knowledge_bases": knowledge_bases,
-        }
-        expected_response = knowledge_base_pb2.ListKnowledgeBasesResponse(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.KnowledgeBasesClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-
-        paged_list_response = client.list_knowledge_bases(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.knowledge_bases[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = knowledge_base_pb2.ListKnowledgeBasesRequest(parent=parent)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_knowledge_bases_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.KnowledgeBasesClient()
-
-        # Setup request
-        parent = client.project_path("[PROJECT]")
-
-        paged_list_response = client.list_knowledge_bases(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_get_knowledge_base(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        display_name = "displayName1615086568"
-        language_code = "languageCode-412800396"
-        expected_response = {
-            "name": name_2,
-            "display_name": display_name,
-            "language_code": language_code,
-        }
-        expected_response = knowledge_base_pb2.KnowledgeBase(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.KnowledgeBasesClient()
-
-        # Setup Request
-        name = client.knowledge_base_path("[PROJECT]", "[KNOWLEDGE_BASE]")
-
-        response = client.get_knowledge_base(name)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = knowledge_base_pb2.GetKnowledgeBaseRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_knowledge_base_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.KnowledgeBasesClient()
-
-        # Setup request
-        name = client.knowledge_base_path("[PROJECT]", "[KNOWLEDGE_BASE]")
-
-        with pytest.raises(CustomException):
-            client.get_knowledge_base(name)
-
-    def test_create_knowledge_base(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        language_code = "languageCode-412800396"
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "language_code": language_code,
-        }
-        expected_response = knowledge_base_pb2.KnowledgeBase(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.KnowledgeBasesClient()
-
-        # Setup Request
-        parent = client.project_path("[PROJECT]")
-        knowledge_base = {}
-
-        response = client.create_knowledge_base(parent, knowledge_base)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = knowledge_base_pb2.CreateKnowledgeBaseRequest(
-            parent=parent, knowledge_base=knowledge_base
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_create_knowledge_base_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.KnowledgeBasesClient()
-
-        # Setup request
-        parent = client.project_path("[PROJECT]")
-        knowledge_base = {}
-
-        with pytest.raises(CustomException):
-            client.create_knowledge_base(parent, knowledge_base)
-
-    def test_delete_knowledge_base(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.KnowledgeBasesClient()
-
-        # Setup Request
-        name = client.knowledge_base_path("[PROJECT]", "[KNOWLEDGE_BASE]")
-
-        client.delete_knowledge_base(name)
-
-        assert len(channel.requests) == 1
-        expected_request = knowledge_base_pb2.DeleteKnowledgeBaseRequest(name=name)
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_knowledge_base_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.KnowledgeBasesClient()
-
-        # Setup request
-        name = client.knowledge_base_path("[PROJECT]", "[KNOWLEDGE_BASE]")
-
-        with pytest.raises(CustomException):
-            client.delete_knowledge_base(name)
-
-    def test_update_knowledge_base(self):
-        # Setup Expected Response
-        name = "name3373707"
-        display_name = "displayName1615086568"
-        language_code = "languageCode-412800396"
-        expected_response = {
-            "name": name,
-            "display_name": display_name,
-            "language_code": language_code,
-        }
-        expected_response = knowledge_base_pb2.KnowledgeBase(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.KnowledgeBasesClient()
-
-        # Setup Request
-        knowledge_base = {}
-
-        response = client.update_knowledge_base(knowledge_base)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = knowledge_base_pb2.UpdateKnowledgeBaseRequest(
-            knowledge_base=knowledge_base
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_update_knowledge_base_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.KnowledgeBasesClient()
-
-        # Setup request
-        knowledge_base = {}
-
-        with pytest.raises(CustomException):
-            client.update_knowledge_base(knowledge_base)
diff --git a/tests/unit/gapic/v2beta1/test_session_entity_types_client_v2beta1.py b/tests/unit/gapic/v2beta1/test_session_entity_types_client_v2beta1.py
deleted file mode 100644
index a68ae3035..000000000
--- a/tests/unit/gapic/v2beta1/test_session_entity_types_client_v2beta1.py
+++ /dev/null
@@ -1,273 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-import dialogflow_v2beta1
-from dialogflow_v2beta1.proto import session_entity_type_pb2
-from google.protobuf import empty_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestSessionEntityTypesClient(object):
-    def test_list_session_entity_types(self):
-        # Setup Expected Response
-        next_page_token = ""
-        session_entity_types_element = {}
-        session_entity_types = [session_entity_types_element]
-        expected_response = {
-            "next_page_token": next_page_token,
-            "session_entity_types": session_entity_types,
-        }
-        expected_response = session_entity_type_pb2.ListSessionEntityTypesResponse(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionEntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_session_entity_types(parent)
-        resources = list(paged_list_response)
-        assert len(resources) == 1
-
-        assert expected_response.session_entity_types[0] == resources[0]
-
-        assert len(channel.requests) == 1
-        expected_request = session_entity_type_pb2.ListSessionEntityTypesRequest(
-            parent=parent
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_list_session_entity_types_exception(self):
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionEntityTypesClient()
-
-        # Setup request
-        parent = "parent-995424086"
-
-        paged_list_response = client.list_session_entity_types(parent)
-        with pytest.raises(CustomException):
-            list(paged_list_response)
-
-    def test_get_session_entity_type(self):
-        # Setup Expected Response
-        name_2 = "name2-1052831874"
-        expected_response = {"name": name_2}
-        expected_response = session_entity_type_pb2.SessionEntityType(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionEntityTypesClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        response = client.get_session_entity_type(name)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = session_entity_type_pb2.GetSessionEntityTypeRequest(
-            name=name
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_get_session_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionEntityTypesClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.get_session_entity_type(name)
-
-    def test_create_session_entity_type(self):
-        # Setup Expected Response
-        name = "name3373707"
-        expected_response = {"name": name}
-        expected_response = session_entity_type_pb2.SessionEntityType(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionEntityTypesClient()
-
-        # Setup Request
-        parent = "parent-995424086"
-        session_entity_type = {}
-
-        response = client.create_session_entity_type(parent, session_entity_type)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = session_entity_type_pb2.CreateSessionEntityTypeRequest(
-            parent=parent, session_entity_type=session_entity_type
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_create_session_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionEntityTypesClient()
-
-        # Setup request
-        parent = "parent-995424086"
-        session_entity_type = {}
-
-        with pytest.raises(CustomException):
-            client.create_session_entity_type(parent, session_entity_type)
-
-    def test_update_session_entity_type(self):
-        # Setup Expected Response
-        name = "name3373707"
-        expected_response = {"name": name}
-        expected_response = session_entity_type_pb2.SessionEntityType(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionEntityTypesClient()
-
-        # Setup Request
-        session_entity_type = {}
-
-        response = client.update_session_entity_type(session_entity_type)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = session_entity_type_pb2.UpdateSessionEntityTypeRequest(
-            session_entity_type=session_entity_type
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_update_session_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionEntityTypesClient()
-
-        # Setup request
-        session_entity_type = {}
-
-        with pytest.raises(CustomException):
-            client.update_session_entity_type(session_entity_type)
-
-    def test_delete_session_entity_type(self):
-        channel = ChannelStub()
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionEntityTypesClient()
-
-        # Setup Request
-        name = "name3373707"
-
-        client.delete_session_entity_type(name)
-
-        assert len(channel.requests) == 1
-        expected_request = session_entity_type_pb2.DeleteSessionEntityTypeRequest(
-            name=name
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_delete_session_entity_type_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionEntityTypesClient()
-
-        # Setup request
-        name = "name3373707"
-
-        with pytest.raises(CustomException):
-            client.delete_session_entity_type(name)
diff --git a/tests/unit/gapic/v2beta1/test_sessions_client_v2beta1.py b/tests/unit/gapic/v2beta1/test_sessions_client_v2beta1.py
deleted file mode 100644
index 0492a25ab..000000000
--- a/tests/unit/gapic/v2beta1/test_sessions_client_v2beta1.py
+++ /dev/null
@@ -1,162 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 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
-#
-#     https://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.
-
-"""Unit tests."""
-
-import mock
-import pytest
-
-import dialogflow_v2beta1
-from dialogflow_v2beta1.proto import session_pb2
-
-
-class MultiCallableStub(object):
-    """Stub for the grpc.UnaryUnaryMultiCallable interface."""
-
-    def __init__(self, method, channel_stub):
-        self.method = method
-        self.channel_stub = channel_stub
-
-    def __call__(self, request, timeout=None, metadata=None, credentials=None):
-        self.channel_stub.requests.append((self.method, request))
-
-        response = None
-        if self.channel_stub.responses:
-            response = self.channel_stub.responses.pop()
-
-        if isinstance(response, Exception):
-            raise response
-
-        if response:
-            return response
-
-
-class ChannelStub(object):
-    """Stub for the grpc.Channel interface."""
-
-    def __init__(self, responses=[]):
-        self.responses = responses
-        self.requests = []
-
-    def unary_unary(self, method, request_serializer=None, response_deserializer=None):
-        return MultiCallableStub(method, self)
-
-    def stream_stream(
-        self, method, request_serializer=None, response_deserializer=None
-    ):
-        return MultiCallableStub(method, self)
-
-
-class CustomException(Exception):
-    pass
-
-
-class TestSessionsClient(object):
-    def test_detect_intent(self):
-        # Setup Expected Response
-        response_id = "responseId1847552473"
-        output_audio = b"24"
-        expected_response = {"response_id": response_id, "output_audio": output_audio}
-        expected_response = session_pb2.DetectIntentResponse(**expected_response)
-
-        # Mock the API response
-        channel = ChannelStub(responses=[expected_response])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionsClient()
-
-        # Setup Request
-        session = "session1984987798"
-        query_input = {}
-
-        response = client.detect_intent(session, query_input)
-        assert expected_response == response
-
-        assert len(channel.requests) == 1
-        expected_request = session_pb2.DetectIntentRequest(
-            session=session, query_input=query_input
-        )
-        actual_request = channel.requests[0][1]
-        assert expected_request == actual_request
-
-    def test_detect_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionsClient()
-
-        # Setup request
-        session = "session1984987798"
-        query_input = {}
-
-        with pytest.raises(CustomException):
-            client.detect_intent(session, query_input)
-
-    def test_streaming_detect_intent(self):
-        # Setup Expected Response
-        response_id = "responseId1847552473"
-        output_audio = b"24"
-        expected_response = {"response_id": response_id, "output_audio": output_audio}
-        expected_response = session_pb2.StreamingDetectIntentResponse(
-            **expected_response
-        )
-
-        # Mock the API response
-        channel = ChannelStub(responses=[iter([expected_response])])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionsClient()
-
-        # Setup Request
-        session = "session1984987798"
-        query_input = {}
-        request = {"session": session, "query_input": query_input}
-        request = session_pb2.StreamingDetectIntentRequest(**request)
-        requests = [request]
-
-        response = client.streaming_detect_intent(requests)
-        resources = list(response)
-        assert len(resources) == 1
-        assert expected_response == resources[0]
-
-        assert len(channel.requests) == 1
-        actual_requests = channel.requests[0][1]
-        assert len(actual_requests) == 1
-        actual_request = list(actual_requests)[0]
-        assert request == actual_request
-
-    def test_streaming_detect_intent_exception(self):
-        # Mock the API response
-        channel = ChannelStub(responses=[CustomException()])
-        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
-        with patch as create_channel:
-            create_channel.return_value = channel
-            client = dialogflow_v2beta1.SessionsClient()
-
-        # Setup request
-        session = "session1984987798"
-        query_input = {}
-        request = {"session": session, "query_input": query_input}
-
-        request = session_pb2.StreamingDetectIntentRequest(**request)
-        requests = [request]
-
-        with pytest.raises(CustomException):
-            client.streaming_detect_intent(requests)